Skip to content

Commit

Permalink
fix(logger): LogLevelDisabled does no longer print anything (#601)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarvinJWendt committed Dec 29, 2023
1 parent 4048ff9 commit d764a3e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,9 @@ func (l Logger) AppendKeyStyle(key string, style Style) *Logger {

// CanPrint checks if the logger can print a specific log level.
func (l Logger) CanPrint(level LogLevel) bool {
if l.Level == LogLevelDisabled {
return false
}
return l.Level <= level
}

Expand Down Expand Up @@ -261,7 +264,7 @@ func (l Logger) combineArgs(args ...[]LoggerArgument) []LoggerArgument {
}

func (l Logger) print(level LogLevel, msg string, args []LoggerArgument) {
if l.Level > level {
if !l.CanPrint(level) {
return
}

Expand Down

0 comments on commit d764a3e

Please sign in to comment.