fix: log level

This commit is contained in:
Ludovic Fernandez 2022-11-25 09:52:04 +01:00 committed by GitHub
parent 0ba51d62fa
commit bee86b5ac7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -27,16 +27,15 @@ func setupLogger(staticConfiguration *static.Configuration) {
// configure log level // configure log level
logLevel := getLogLevel(staticConfiguration) logLevel := getLogLevel(staticConfiguration)
zerolog.SetGlobalLevel(logLevel)
// create logger // create logger
logCtx := zerolog.New(w).With().Timestamp() logCtx := zerolog.New(w).With().Timestamp()
if logLevel <= zerolog.DebugLevel { if logLevel <= zerolog.DebugLevel {
logCtx = logCtx.Caller() logCtx = logCtx.Caller()
} }
log.Logger = logCtx.Logger() log.Logger = logCtx.Logger().Level(logLevel)
zerolog.DefaultContextLogger = &log.Logger zerolog.DefaultContextLogger = &log.Logger
zerolog.SetGlobalLevel(logLevel)
// Global logrus replacement (related to lib like go-rancher-metadata, docker, etc.) // Global logrus replacement (related to lib like go-rancher-metadata, docker, etc.)
logrus.StandardLogger().Out = logs.NoLevel(log.Logger, zerolog.DebugLevel) logrus.StandardLogger().Out = logs.NoLevel(log.Logger, zerolog.DebugLevel)