Skip to content

Commit

Permalink
fix race condition in entry
Browse files Browse the repository at this point in the history
  • Loading branch information
admacleod committed Mar 19, 2020
1 parent e76a5c4 commit b28acda
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions entry.go
Expand Up @@ -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.
Expand Down

0 comments on commit b28acda

Please sign in to comment.