From e44238600b1f9f4bd9c8569943e61d7eb6e8b024 Mon Sep 17 00:00:00 2001 From: leo Date: Tue, 9 May 2023 13:23:51 +0200 Subject: [PATCH] slogging: add a default if unknown level is set --- slogging/log.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/slogging/log.go b/slogging/log.go index 3cb5f07..59fb130 100644 --- a/slogging/log.go +++ b/slogging/log.go @@ -57,6 +57,11 @@ func SetLevel(level int) *Logger { case 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 {