Skip to content

Commit

Permalink
e2e: use zapcore.Lock
Browse files Browse the repository at this point in the history
Replace zapcore.AddSync with zapcore.Lock for safe concurrent writes to logfile and console.

Signed-off-by: Parikshith <[email protected]>
  • Loading branch information
parikshithb committed Feb 13, 2025
1 parent e2e489f commit 6a668f2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions e2e/test/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ func CreateLogger() (*zap.SugaredLogger, error) {
}

core := zapcore.NewTee(
zapcore.NewCore(logfileEncoder, zapcore.AddSync(logfile), zapcore.DebugLevel),
zapcore.NewCore(consoleEncoder, zapcore.AddSync(os.Stderr), zapcore.InfoLevel),
zapcore.NewCore(logfileEncoder, zapcore.Lock(logfile), zapcore.DebugLevel),
zapcore.NewCore(consoleEncoder, zapcore.Lock(os.Stderr), zapcore.InfoLevel),
)
logger := zap.New(core, zap.AddCaller(), zap.AddStacktrace(zapcore.ErrorLevel))

Expand Down

0 comments on commit 6a668f2

Please sign in to comment.