Skip to content

Commit 2169c2b

Browse files
author
Russ Egan
committed
Minor clarification in the documentation
1 parent 03f15b1 commit 2169c2b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

v2/middleware.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ import (
5353
// - slog.SourceKey: skipped
5454
// - slog.MessageKey: ignores changes to the key name. If the returned value is empty, the message will
5555
// be set to the value `<nil>`. Non-string values are coerced to a string like `fmt.Print`
56-
// - slog.TimeKey: ignores changes to the key name. If the value returned is not empty or a time.Time{}, it is
57-
// ignored.
58-
// - slog.LevelKey: ignores changes to the key name. If the value returned is not empty or a slog.Level, it is
59-
// ignored.
56+
// - slog.TimeKey: ignores changes to the key name. The slog.Value returned must either be empty, or
57+
// a slog.KindTime. Other values will be ignored.
58+
// - slog.LevelKey: ignores changes to the key name. The slog.Value returned must either be empty, or
59+
// be a slog.KindAny containing a slog.Level value. Other values will be ignored.
6060
//
6161
// The middleware may be further configured to skip processing built-in attributes, or skipping processing
6262
// for particular records.
@@ -168,7 +168,7 @@ func (r *ReplaceAttrsMiddleware) applyToLevel(l slog.Level) slog.Level {
168168
if attr.Value.Equal(slog.Value{}) {
169169
return slog.LevelInfo
170170
}
171-
if attr.Value.Kind() == slog.KindAny && attr.Key == slog.LevelKey {
171+
if attr.Value.Kind() == slog.KindAny {
172172
if lvl, ok := attr.Value.Any().(slog.Level); ok {
173173
return lvl
174174
}

0 commit comments

Comments
 (0)