mirror of
https://codeberg.org/woodpecker-plugins/go-plugin.git
synced 2024-11-24 22:35:39 +01:00
Use console logger instead of JSON output (#1)
Co-authored-by: Lauris BH <lauris@nix.lv> Reviewed-on: https://codeberg.org/woodpecker-plugins/go-plugin/pulls/1
This commit is contained in:
parent
60d32ee4ae
commit
e5ca84b806
@ -15,6 +15,8 @@
|
|||||||
package plugin
|
package plugin
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"os"
|
||||||
|
|
||||||
"github.com/rs/zerolog"
|
"github.com/rs/zerolog"
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli/v2"
|
||||||
@ -39,6 +41,7 @@ func SetupConsoleLogger(c *cli.Context) error {
|
|||||||
log.Fatal().Msgf("unknown logging level: %s", level)
|
log.Fatal().Msgf("unknown logging level: %s", level)
|
||||||
}
|
}
|
||||||
zerolog.SetGlobalLevel(lvl)
|
zerolog.SetGlobalLevel(lvl)
|
||||||
|
log.Logger = zerolog.New(zerolog.ConsoleWriter{Out: os.Stdout}).With().Timestamp().Logger()
|
||||||
if zerolog.GlobalLevel() <= zerolog.DebugLevel {
|
if zerolog.GlobalLevel() <= zerolog.DebugLevel {
|
||||||
log.Logger = log.With().Caller().Logger()
|
log.Logger = log.With().Caller().Logger()
|
||||||
log.Log().Msgf("LogLevel = %s", zerolog.GlobalLevel().String())
|
log.Log().Msgf("LogLevel = %s", zerolog.GlobalLevel().String())
|
||||||
|
Loading…
Reference in New Issue
Block a user