Skip to content

Commit

Permalink
fix(*) allow verbose log levels (#2351) (#2356)
Browse files Browse the repository at this point in the history
When we are in debug logging mode, update the underlying zap log level
so that verbose logs up to level 10 will be emitted.

This fixes #2350.

Signed-off-by: James Peach <james.peach@konghq.com>
(cherry picked from commit 3a950af)

Co-authored-by: James Peach <james.peach@konghq.com>
  • Loading branch information
mergify[bot] and jpeach authored Jul 13, 2021
1 parent 38fdc1c commit 0f1e4ab
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/log/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,11 @@ func newZapLoggerTo(destWriter io.Writer, level LogLevel, opts ...zap.Option) *z
case OffLevel:
return zap.NewNop()
case DebugLevel:
lvl = zap.NewAtomicLevelAt(zap.DebugLevel)
// The value we pass here is the most verbose level that
// will end up being emitted through the `V(level int)`
// accessor. Passing -10 ensures that levels up to `V(10)`
// will work, which seems like plenty.
lvl = zap.NewAtomicLevelAt(-10)
opts = append(opts, zap.Development(), zap.AddStacktrace(zap.ErrorLevel))
default:
lvl = zap.NewAtomicLevelAt(zap.InfoLevel)
Expand Down

0 comments on commit 0f1e4ab

Please sign in to comment.