Skip to content

Commit

Permalink
promlog: check the log level first
Browse files Browse the repository at this point in the history
Signed-off-by: royeo <ljn6176@gmail.com>
  • Loading branch information
royeo committed Aug 12, 2021
1 parent 8d1c9f8 commit 71311f1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion promlog/log.go
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 71311f1

Please sign in to comment.