From e5ca84b8063d6b8ba46a7f998a89c19290b0e4b3 Mon Sep 17 00:00:00 2001 From: Lauris BH Date: Mon, 9 Jan 2023 01:17:04 +0000 Subject: [PATCH] Use console logger instead of JSON output (#1) Co-authored-by: Lauris BH Reviewed-on: https://codeberg.org/woodpecker-plugins/go-plugin/pulls/1 --- logger.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/logger.go b/logger.go index 19c2bcd..05f65eb 100644 --- a/logger.go +++ b/logger.go @@ -15,6 +15,8 @@ package plugin import ( + "os" + "github.com/rs/zerolog" "github.com/rs/zerolog/log" "github.com/urfave/cli/v2" @@ -39,6 +41,7 @@ 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() if zerolog.GlobalLevel() <= zerolog.DebugLevel { log.Logger = log.With().Caller().Logger() log.Log().Msgf("LogLevel = %s", zerolog.GlobalLevel().String())