Skip to content

Commit

Permalink
promlog: check the log level first (#322)
Browse files Browse the repository at this point in the history
Signed-off-by: royeo <[email protected]>
  • Loading branch information
royeo authored Sep 26, 2021
1 parent fe057a9 commit eb9347f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion promlog/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,11 @@ func New(config *Config) log.Logger {
l = log.NewLogfmtLogger(log.NewSyncWriter(os.Stderr))
}

l = log.With(l, "ts", timestampFormat, "caller", log.DefaultCaller)

if config.Level != nil {
l = level.NewFilter(l, config.Level.o)
}
l = log.With(l, "ts", timestampFormat, "caller", log.DefaultCaller)
return l
}

Expand Down

0 comments on commit eb9347f

Please sign in to comment.