diff --git a/cmd/kpod/main.go b/cmd/kpod/main.go index 804f762a..bfe87738 100644 --- a/cmd/kpod/main.go +++ b/cmd/kpod/main.go @@ -58,11 +58,21 @@ func main() { waitCommand, } app.Before = func(c *cli.Context) error { - logrus.SetLevel(logrus.ErrorLevel) - if c.GlobalBool("debug") { - debug = true - logrus.SetLevel(logrus.DebugLevel) + logLevel := c.GlobalString("log-level") + if logLevel != "" { + level, err := logrus.ParseLevel(logLevel) + if err != nil { + return err + } + + logrus.SetLevel(level) } + + if logLevel == "debug" { + debug = true + + } + return nil } app.After = func(*cli.Context) error { @@ -80,9 +90,10 @@ func main() { Name: "config, c", Usage: "path of a config file detailing container server configuration options", }, - cli.BoolFlag{ - Name: "debug", - Usage: "print debugging information", + cli.StringFlag{ + Name: "log-level", + Usage: "log messages above specified level: debug, info, warn, error (default), fatal or panic", + Value: "error", }, cli.StringFlag{ Name: "root", diff --git a/completions/bash/kpod b/completions/bash/kpod index a18c4f8d..398cce79 100644 --- a/completions/bash/kpod +++ b/completions/bash/kpod @@ -438,9 +438,9 @@ _kpod_kpod() { --runroot --storage-driver --storage-opt + --log-level " local boolean_options=" - --debug --help -h --version -v " diff --git a/docs/kpod.1.md b/docs/kpod.1.md index 1617b252..488c165c 100644 --- a/docs/kpod.1.md +++ b/docs/kpod.1.md @@ -26,8 +26,8 @@ has the capability to debug pods/images created by crio. **--config value, -c**=**"config.file"** Path of a config file detailing container server configuration options -**--debug** - Print debugging information +**--log-level** + log messages above specified level: debug, info, warn, error (default), fatal or panic **--root**=**value** Path to the root directory in which data, including images, is stored