mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-04-26 13:34:45 +00:00
Do not print log level on CLI (#2638)
if it's not in debug log level closes https://github.com/woodpecker-ci/woodpecker/issues/1764
This commit is contained in:
parent
a1a35eb7be
commit
d5e68efc95
5 changed files with 8 additions and 9 deletions
|
@ -21,6 +21,6 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func SetupGlobalLogger(c *cli.Context) error {
|
func SetupGlobalLogger(c *cli.Context) error {
|
||||||
common.SetupGlobalLogger(c)
|
common.SetupGlobalLogger(c, false)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func run(c *cli.Context) error {
|
func run(c *cli.Context) error {
|
||||||
common.SetupGlobalLogger(c)
|
common.SetupGlobalLogger(c, true)
|
||||||
|
|
||||||
agentConfigPath := c.String("agent-config")
|
agentConfigPath := c.String("agent-config")
|
||||||
hostname := c.String("hostname")
|
hostname := c.String("hostname")
|
||||||
|
|
|
@ -41,6 +41,7 @@ func newApp() *cli.App {
|
||||||
app.Usage = "command line utility"
|
app.Usage = "command line utility"
|
||||||
app.EnableBashCompletion = true
|
app.EnableBashCompletion = true
|
||||||
app.Flags = common.GlobalFlags
|
app.Flags = common.GlobalFlags
|
||||||
|
app.Before = common.SetupGlobalLogger
|
||||||
app.Commands = []*cli.Command{
|
app.Commands = []*cli.Command{
|
||||||
pipeline.Command,
|
pipeline.Command,
|
||||||
log.Command,
|
log.Command,
|
||||||
|
@ -56,9 +57,5 @@ func newApp() *cli.App {
|
||||||
cron.Command,
|
cron.Command,
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, command := range app.Commands {
|
|
||||||
command.Before = common.SetupGlobalLogger
|
|
||||||
}
|
|
||||||
|
|
||||||
return app
|
return app
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ var GlobalLoggerFlags = []cli.Flag{
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
func SetupGlobalLogger(c *cli.Context) {
|
func SetupGlobalLogger(c *cli.Context, printLvl bool) {
|
||||||
logLevel := c.String("log-level")
|
logLevel := c.String("log-level")
|
||||||
pretty := c.Bool("pretty")
|
pretty := c.Bool("pretty")
|
||||||
noColor := c.Bool("nocolor")
|
noColor := c.Bool("nocolor")
|
||||||
|
@ -96,5 +96,7 @@ func SetupGlobalLogger(c *cli.Context) {
|
||||||
log.Logger = log.With().Caller().Logger()
|
log.Logger = log.With().Caller().Logger()
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Info().Msgf("LogLevel = %s", zerolog.GlobalLevel().String())
|
if printLvl {
|
||||||
|
log.Info().Msgf("LogLevel = %s", zerolog.GlobalLevel().String())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func run(c *cli.Context) error {
|
func run(c *cli.Context) error {
|
||||||
common.SetupGlobalLogger(c)
|
common.SetupGlobalLogger(c, true)
|
||||||
|
|
||||||
// set gin mode based on log level
|
// set gin mode based on log level
|
||||||
if zerolog.GlobalLevel() > zerolog.DebugLevel {
|
if zerolog.GlobalLevel() > zerolog.DebugLevel {
|
||||||
|
|
Loading…
Reference in a new issue