Merge pull request #744 from rhatdan/debug

Add --debug flag to kpod to turn up logging level to debug
This commit is contained in:
Mrunal Patel 2017-08-14 16:21:22 -07:00 committed by GitHub
commit 36fd0a7208
6 changed files with 73 additions and 16 deletions

View file

@ -4,6 +4,7 @@ import (
is "github.com/containers/image/storage"
"github.com/containers/storage"
"github.com/kubernetes-incubator/cri-o/libkpod"
"github.com/sirupsen/logrus"
"github.com/urfave/cli"
)
@ -46,5 +47,9 @@ func getConfig(c *cli.Context) (*libkpod.Config, error) {
config.StorageOptions = opts
}
}
if c.Bool("debug") {
logrus.SetLevel(logrus.DebugLevel)
}
return config, nil
}

View file

@ -15,6 +15,7 @@ func main() {
if reexec.Init() {
return
}
logrus.SetLevel(logrus.ErrorLevel)
app := cli.NewApp()
app.Name = "kpod"
@ -28,20 +29,28 @@ func main() {
imagesCommand,
infoCommand,
inspectCommand,
loadCommand,
mountCommand,
pullCommand,
pushCommand,
rmiCommand,
saveCommand,
tagCommand,
umountCommand,
versionCommand,
saveCommand,
loadCommand,
}
app.Flags = []cli.Flag{
cli.StringFlag{
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: "root",
Usage: "path to the root directory in which data, including images, is stored",
Usage: "path to the root directory in which data, including images, is stored",
},
cli.StringFlag{
Name: "runroot",
@ -55,12 +64,9 @@ func main() {
Name: "storage-opt",
Usage: "used to pass an option to the storage driver",
},
cli.StringFlag{
Name: "config, c",
Usage: "path of a config file detailing container server configuration options",
},
}
if err := app.Run(os.Args); err != nil {
logrus.Fatal(err)
logrus.Errorf(err.Error())
os.Exit(1)
}
}