mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-26 11:51:02 +00:00
Set default logging value of cli to info (#871)
This commit is contained in:
parent
c310363c99
commit
cddc54bae4
2 changed files with 6 additions and 7 deletions
|
@ -51,6 +51,7 @@ var GlobalFlags = []cli.Flag{
|
|||
EnvVars: []string{"WOODPECKER_LOG_LEVEL"},
|
||||
Name: "log-level",
|
||||
Usage: "set logging level",
|
||||
Value: "info",
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -7,14 +7,12 @@ import (
|
|||
)
|
||||
|
||||
func SetupConsoleLogger(c *cli.Context) error {
|
||||
if c.IsSet("log-level") {
|
||||
level := c.String("log-level")
|
||||
lvl, err := zerolog.ParseLevel(level)
|
||||
if err != nil {
|
||||
log.Fatal().Msgf("unknown logging level: %s", level)
|
||||
}
|
||||
zerolog.SetGlobalLevel(lvl)
|
||||
level := c.String("log-level")
|
||||
lvl, err := zerolog.ParseLevel(level)
|
||||
if err != nil {
|
||||
log.Fatal().Msgf("unknown logging level: %s", level)
|
||||
}
|
||||
zerolog.SetGlobalLevel(lvl)
|
||||
if zerolog.GlobalLevel() <= zerolog.DebugLevel {
|
||||
log.Logger = log.With().Caller().Logger()
|
||||
log.Log().Msgf("LogLevel = %s", zerolog.GlobalLevel().String())
|
||||
|
|
Loading…
Reference in a new issue