mirror of https://github.com/sirupsen/logrus.git
Lock mutex before formatting to avoid race
This commit is contained in:
parent
efbfdb5f09
commit
eeb653535c
2
entry.go
2
entry.go
|
@ -123,9 +123,9 @@ func (entry *Entry) fireHooks() {
|
|||
}
|
||||
|
||||
func (entry *Entry) write() {
|
||||
serialized, err := entry.Logger.Formatter.Format(entry)
|
||||
entry.Logger.mu.Lock()
|
||||
defer entry.Logger.mu.Unlock()
|
||||
serialized, err := entry.Logger.Formatter.Format(entry)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Failed to obtain reader, %v\n", err)
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue