Skip to content

Commit

Permalink
internal/debug: add log.logfmt flag to set logging to use logfmt (eth…
Browse files Browse the repository at this point in the history
  • Loading branch information
ajsutton authored and mmsqe committed Dec 7, 2023
1 parent fe50cb4 commit 4154e1f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions internal/debug/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ var (
Usage: "Format logs with JSON",
Category: flags.LoggingCategory,
}
logfmtFlag = &cli.BoolFlag{
Name: "log.logfmt",
Usage: "Format logs with logfmt",
Category: flags.LoggingCategory,
}
logFileFlag = &cli.StringFlag{
Name: "log.file",
Usage: "Write logs to a file",
Expand Down Expand Up @@ -115,6 +120,7 @@ var Flags = []cli.Flag{
verbosityFlag,
vmoduleFlag,
logjsonFlag,
logfmtFlag,
logFileFlag,
backtraceAtFlag,
debugFlag,
Expand Down Expand Up @@ -147,6 +153,8 @@ func Setup(ctx *cli.Context) error {
var logfmt log.Format
if ctx.Bool(logjsonFlag.Name) {
logfmt = log.JSONFormat()
} else if ctx.Bool(logfmtFlag.Name) {
logfmt = log.LogfmtFormat()
} else {
logfmt = log.TerminalFormat(useColor)
}
Expand Down

0 comments on commit 4154e1f

Please sign in to comment.