Exclude time from log (#2)

Co-authored-by: Lauris BH <lauris@nix.lv>
Reviewed-on: https://codeberg.org/woodpecker-plugins/go-plugin/pulls/2
This commit is contained in:
Lauris BH 2023-01-09 11:53:08 +00:00
parent e5ca84b806
commit 8208462a69

View File

@ -41,7 +41,10 @@ func SetupConsoleLogger(c *cli.Context) error {
log.Fatal().Msgf("unknown logging level: %s", level)
}
zerolog.SetGlobalLevel(lvl)
log.Logger = zerolog.New(zerolog.ConsoleWriter{Out: os.Stdout}).With().Timestamp().Logger()
log.Logger = zerolog.New(zerolog.ConsoleWriter{
Out: os.Stdout,
FieldsExclude: []string{"time"},
}).With().Timestamp().Logger()
if zerolog.GlobalLevel() <= zerolog.DebugLevel {
log.Logger = log.With().Caller().Logger()
log.Log().Msgf("LogLevel = %s", zerolog.GlobalLevel().String())