diff --git a/cmd/containerd/main.go b/cmd/containerd/main.go index f6a5ee8..560ccf2 100644 --- a/cmd/containerd/main.go +++ b/cmd/containerd/main.go @@ -48,6 +48,11 @@ high performance container runtime Name: "debug", Usage: "enable debug output in logs", }, + cli.StringFlag{ + Name: "log-level", + Usage: "Set the logging level [debug, info, warn, error, fatal, panic]", + Value: "info", + }, cli.StringFlag{ Name: "root", Usage: "containerd state directory", @@ -78,6 +83,14 @@ high performance container runtime if context.GlobalBool("debug") { logrus.SetLevel(logrus.DebugLevel) } + if logLevel := context.GlobalString("log-level"); logLevel != "" { + lvl, err := logrus.ParseLevel(logLevel) + if err != nil { + lvl = logrus.InfoLevel + fmt.Fprintf(os.Stderr, "Unable to parse logging level: %s\n, and being defaulted to info", logLevel) + } + logrus.SetLevel(lvl) + } return nil } app.Action = func(context *cli.Context) error {