Skip to content

Commit 1ce5208

Browse files
committed
replaceAttr with type safety
Signed-off-by: Bernd Ritter <ritter@b1-systems.de> On-behalf-of: SAP <b.ritter@sap.com>
1 parent 9cb6998 commit 1ce5208

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

cmd/glvd2/main.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ import (
2525
// Allows rendering of the new log level "trace".
2626
func replaceAttr(_ []string, a slog.Attr) slog.Attr {
2727
if a.Key == slog.LevelKey {
28-
level := a.Value.Any().(slog.Level) //nolint: forcetypeassert,revive // ignore for trace logging
28+
level, ok := a.Value.Any().(slog.Level)
29+
if !ok {
30+
return a
31+
}
2932
if logging.LevelTrace == level {
3033
a.Value = slog.StringValue("TRACE")
3134
}

0 commit comments

Comments
 (0)