mirror of https://github.com/docker/docs.git
Replace --debug with --log-level
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
parent
027f8ed44a
commit
5200e3e764
14
main.go
14
main.go
|
@ -25,19 +25,21 @@ func main() {
|
||||||
app.Email = ""
|
app.Email = ""
|
||||||
|
|
||||||
app.Flags = []cli.Flag{
|
app.Flags = []cli.Flag{
|
||||||
cli.BoolFlag{
|
cli.StringFlag{
|
||||||
Name: "debug",
|
Name: "log-level, l",
|
||||||
Usage: "debug mode",
|
Value: "info",
|
||||||
EnvVar: "DEBUG",
|
Usage: fmt.Sprintf("Log level (options: debug, info, warn, error, fatal, panic)"),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
// logs
|
// logs
|
||||||
app.Before = func(c *cli.Context) error {
|
app.Before = func(c *cli.Context) error {
|
||||||
log.SetOutput(os.Stderr)
|
log.SetOutput(os.Stderr)
|
||||||
if c.Bool("debug") {
|
level, err := log.ParseLevel(c.String("log-level"))
|
||||||
log.SetLevel(log.DebugLevel)
|
if err != nil {
|
||||||
|
log.Fatalf(err.Error())
|
||||||
}
|
}
|
||||||
|
log.SetLevel(level)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue