Skip to content

Commit

Permalink
fix: fix logger mutex locking in .New method (#2114)
Browse files Browse the repository at this point in the history
  • Loading branch information
qdm12 authored Dec 17, 2021
1 parent 8cf34d2 commit e7207ed
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/log/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ func New(options ...Option) *Logger {
// It can use a different writer, but it is expected to use the
// same writer since it is thread safe.
func (l *Logger) New(options ...Option) *Logger {
l.mutex.Lock()
defer l.mutex.Unlock()

var childSettings settings
childSettings.mergeWith(l.settings)
childSettings.mergeWith(newSettings(options))
Expand Down

0 comments on commit e7207ed

Please sign in to comment.