Skip to content

Commit c9d27ad

Browse files
author
Mrunal Patel
authored
Merge pull request cri-o#779 from nalind/kpod-debug-flag
kpod: make --debug work
2 parents 4e9be04 + 05985ff commit c9d27ad

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

cmd/kpod/common.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77
"github.com/containers/storage"
88
"github.com/fatih/camelcase"
99
"github.com/kubernetes-incubator/cri-o/libkpod"
10-
"github.com/sirupsen/logrus"
1110
"github.com/urfave/cli"
1211
)
1312

@@ -50,9 +49,6 @@ func getConfig(c *cli.Context) (*libkpod.Config, error) {
5049
config.StorageOptions = opts
5150
}
5251
}
53-
if c.Bool("debug") {
54-
logrus.SetLevel(logrus.DebugLevel)
55-
}
5652
if c.GlobalIsSet("runtime") {
5753
config.Runtime = c.GlobalString("runtime")
5854
}

cmd/kpod/main.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ func main() {
1515
if reexec.Init() {
1616
return
1717
}
18-
logrus.SetLevel(logrus.ErrorLevel)
1918

2019
app := cli.NewApp()
2120
app.Name = "kpod"
@@ -44,6 +43,13 @@ func main() {
4443
statsCommand,
4544
loadCommand,
4645
}
46+
app.Before = func(c *cli.Context) error {
47+
logrus.SetLevel(logrus.ErrorLevel)
48+
if c.GlobalBool("debug") {
49+
logrus.SetLevel(logrus.DebugLevel)
50+
}
51+
return nil
52+
}
4753
app.Flags = []cli.Flag{
4854
cli.StringFlag{
4955
Name: "config, c",

0 commit comments

Comments
 (0)