Skip to content

Commit

Permalink
Don't include stack traces for warnings during tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelSnowden committed Mar 24, 2023
1 parent 63b22ca commit 6ffcfe9
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions common/log/zap_logger.go
Expand Up @@ -61,11 +61,17 @@ func NewTestLogger() *zapLogger {
if format == "" {
format = "console"
}
return NewZapLogger(BuildZapLogger(Config{

logger := BuildZapLogger(Config{
Level: os.Getenv(testLogLevelEnvVar),
Format: format,
Development: true,
}))
})

// Don't include stack traces for warnings during tests. Only include them for logs with level error and above.
logger = logger.WithOptions(zap.AddStacktrace(zap.ErrorLevel))

return NewZapLogger(logger)
}

// NewCLILogger returns a logger at debug level and log into STDERR for logging from within CLI tools
Expand Down

0 comments on commit 6ffcfe9

Please sign in to comment.