Skip to content

Commit

Permalink
proposed solution to logging in json format
Browse files Browse the repository at this point in the history
Signed-off-by: Demmus Hentze Højgaard <dhh@ft.fo>
  • Loading branch information
summed authored and yasker committed Jul 1, 2020
1 parent 0123d61 commit ba46079
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ func main() {
if c.GlobalBool("debug") {
logrus.SetLevel(logrus.DebugLevel)
}
if c.GlobalBool("log-json") {
logrus.SetFormatter(&logrus.JSONFormatter{})
}
return nil
}

Expand All @@ -40,6 +43,11 @@ func main() {
Usage: "enable debug logging level",
EnvVar: "RANCHER_DEBUG",
},
cli.BoolFlag{
Name: "log-json, j",
Usage: "log in json format",
EnvVar: "RANCHER_LOG_JSON",
},
}
a.Commands = []cli.Command{
app.DaemonCmd(),
Expand Down

0 comments on commit ba46079

Please sign in to comment.