mirror of
https://github.com/wneessen/go-mail.git
synced 2024-11-15 02:12:55 +01:00
Lock mutex when setting the logger
Add mutex locking to ensure thread-safety when setting the logger in the `smtp` package. This prevents potential race conditions and ensures that the logger is updated consistently in concurrent operations.
This commit is contained in:
parent
59f2778a38
commit
9412f31874
1 changed files with 2 additions and 0 deletions
|
@ -587,7 +587,9 @@ func (c *Client) SetLogger(l log.Logger) {
|
||||||
if l == nil {
|
if l == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
c.mutex.Lock()
|
||||||
c.logger = l
|
c.logger = l
|
||||||
|
c.mutex.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetLogAuthData enables logging of authentication data in the Client.
|
// SetLogAuthData enables logging of authentication data in the Client.
|
||||||
|
|
Loading…
Reference in a new issue