Skip to content

Commit

Permalink
fix race condition
Browse files Browse the repository at this point in the history
  • Loading branch information
alexvelea committed Jul 12, 2023
1 parent 04d46ed commit e11ecdd
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,9 @@ func (l *Logger) SetCallerOffset(offset int) {

// With returns a new logger with the given keyvals added.
func (l *Logger) With(keyvals ...interface{}) *Logger {
l.mu.Lock()
sl := *l
l.mu.Unlock()
sl.b = bytes.Buffer{}
sl.mu = &sync.RWMutex{}
sl.helpers = &sync.Map{}
Expand Down

0 comments on commit e11ecdd

Please sign in to comment.