diff --git a/cmd/kpod/common.go b/cmd/kpod/common.go index 8dc51237..6d1f5299 100644 --- a/cmd/kpod/common.go +++ b/cmd/kpod/common.go @@ -7,7 +7,6 @@ import ( "github.com/containers/storage" "github.com/fatih/camelcase" "github.com/kubernetes-incubator/cri-o/libkpod" - "github.com/sirupsen/logrus" "github.com/urfave/cli" ) @@ -50,9 +49,6 @@ func getConfig(c *cli.Context) (*libkpod.Config, error) { config.StorageOptions = opts } } - if c.Bool("debug") { - logrus.SetLevel(logrus.DebugLevel) - } if c.GlobalIsSet("runtime") { config.Runtime = c.GlobalString("runtime") } diff --git a/cmd/kpod/main.go b/cmd/kpod/main.go index 08b17b83..7ee6d854 100644 --- a/cmd/kpod/main.go +++ b/cmd/kpod/main.go @@ -15,7 +15,6 @@ func main() { if reexec.Init() { return } - logrus.SetLevel(logrus.ErrorLevel) app := cli.NewApp() app.Name = "kpod" @@ -44,6 +43,13 @@ func main() { statsCommand, loadCommand, } + app.Before = func(c *cli.Context) error { + logrus.SetLevel(logrus.ErrorLevel) + if c.GlobalBool("debug") { + logrus.SetLevel(logrus.DebugLevel) + } + return nil + } app.Flags = []cli.Flag{ cli.StringFlag{ Name: "config, c",