diff options
Diffstat (limited to 'cmd/podman/main.go')
-rw-r--r-- | cmd/podman/main.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/cmd/podman/main.go b/cmd/podman/main.go index fefd8fdad..f533a8b13 100644 --- a/cmd/podman/main.go +++ b/cmd/podman/main.go @@ -14,7 +14,9 @@ import ( "github.com/projectatomic/libpod/pkg/rootless" "github.com/projectatomic/libpod/version" "github.com/sirupsen/logrus" + lsyslog "github.com/sirupsen/logrus/hooks/syslog" "github.com/urfave/cli" + "log/syslog" ) // This is populated by the Makefile from the VERSION file @@ -94,6 +96,12 @@ func main() { } app.Before = func(c *cli.Context) error { + if c.GlobalBool("syslog") { + hook, err := lsyslog.NewSyslogHook("", "", syslog.LOG_INFO, "") + if err == nil { + logrus.AddHook(hook) + } + } logLevel := c.GlobalString("log-level") if logLevel != "" { level, err := logrus.ParseLevel(logLevel) @@ -187,6 +195,10 @@ func main() { Name: "storage-opt", Usage: "used to pass an option to the storage driver", }, + cli.BoolFlag{ + Name: "syslog", + Usage: "output logging information to syslog as well as the console", + }, } if _, err := os.Stat("/etc/containers/registries.conf"); err != nil { if os.IsNotExist(err) { |