feat(logging): redirect the standard logger to Zerolog EE-4186 (#7702)

pull/7708/head
andres-portainer 2022-09-19 15:39:43 -03:00 committed by GitHub
parent 70ce4e70d9
commit 0fac1f85f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -1,6 +1,8 @@
package main package main
import ( import (
stdlog "log"
"github.com/rs/zerolog" "github.com/rs/zerolog"
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
"github.com/rs/zerolog/pkgerrors" "github.com/rs/zerolog/pkgerrors"
@ -11,6 +13,9 @@ func configureLogger() {
zerolog.ErrorStackMarshaler = pkgerrors.MarshalStack zerolog.ErrorStackMarshaler = pkgerrors.MarshalStack
zerolog.TimeFieldFormat = zerolog.TimeFormatUnix zerolog.TimeFieldFormat = zerolog.TimeFormatUnix
stdlog.SetFlags(0)
stdlog.SetOutput(log.Logger)
log.Logger = log.Logger.With().Caller().Stack().Logger() log.Logger = log.Logger.With().Caller().Stack().Logger()
} }