slogging: add a default if unknown level is set
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
leo 2023-05-09 13:23:51 +02:00
parent 0efb419d56
commit e44238600b
Signed by: wanderer
SSH Key Fingerprint: SHA256:Dp8+iwKHSlrMEHzE3bJnPng70I7LEsa3IJXRH/U+idQ

@ -57,6 +57,11 @@ func SetLevel(level int) *Logger {
case LevelError: case LevelError:
opts.Level = slog.LevelError opts.Level = slog.LevelError
default:
logger.Infof("unknown level '%d', resetting to level INFO", level)
opts.Level = slog.LevelInfo
} }
if _, ok := logger.Handler().(*slog.JSONHandler); ok { if _, ok := logger.Handler().(*slog.JSONHandler); ok {