From b4d3b560d32f3227b14965a0b02b6e68fc8ebbb1 Mon Sep 17 00:00:00 2001 From: umohnani8 Date: Mon, 9 Oct 2017 13:47:21 -0400 Subject: [PATCH] Changed debug flag to log-level in kpod/main.go The change in flag from debug to log-level was causing cri-o to fail when started There was a reference to the debug flag in kpod/main.go that had not been changed Signed-off-by: umohnani8 --- cmd/kpod/main.go | 25 ++++++++++++++++++------- completions/bash/kpod | 2 +- docs/kpod.1.md | 4 ++-- 3 files changed, 21 insertions(+), 10 deletions(-) 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