From b28acda22db49a5e5ff39f3c23968b02a3585dda Mon Sep 17 00:00:00 2001 From: Alisdair MacLeod Date: Thu, 19 Mar 2020 09:32:08 +0000 Subject: [PATCH] fix race condition in entry --- entry.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/entry.go b/entry.go index 1bf127c..3928671 100644 --- a/entry.go +++ b/entry.go @@ -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.