Skip to content

Commit

Permalink
add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
shipengqi committed Sep 6, 2023
1 parent 38de3ab commit 16286b4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ func New(opts *Options) *Logger {
if !opts.DisableConsoleCaller {
consoleEncCfg.CallerKey = "caller"
}
// forces to use CapitalColorLevelEncoder if LevelEncoder is not set when console color is enabled
if !opts.DisableConsoleColor && opts.LevelEncoder == nil {
consoleEncCfg.EncodeLevel = zapcore.CapitalColorLevelEncoder
}
consoleLevelEnabler := zap.LevelEnablerFunc(func(lvl zapcore.Level) bool {
return lvl >= consoleLevel
})
Expand Down

0 comments on commit 16286b4

Please sign in to comment.