From 8a14277e68206b0fe5fb8e2b9753a6f84c509b78 Mon Sep 17 00:00:00 2001 From: Quentin McGaw Date: Mon, 13 Dec 2021 15:48:22 +0000 Subject: [PATCH] Fix logger mutex locking in `.New` method --- internal/log/logger.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/log/logger.go b/internal/log/logger.go index ebc7eb83a0..1761fc1d6f 100644 --- a/internal/log/logger.go +++ b/internal/log/logger.go @@ -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))