fix race condition in entry

This commit is contained in:
Alisdair MacLeod 2020-03-19 09:32:08 +00:00
parent e76a5c4450
commit b28acda22d
1 changed files with 2 additions and 0 deletions

View File

@ -219,6 +219,8 @@ func (entry Entry) HasCaller() (has bool) {
// This function is not declared with a pointer value because otherwise
// race conditions will occur when using multiple goroutines
func (entry Entry) log(level Level, msg string) {
entry.Logger.mu.Lock()
defer entry.Logger.mu.Unlock()
var buffer *bytes.Buffer
// Default to now, but allow users to override if they want.