]> Cypherpunks repositories - gostls13.git/commitdiff
log/slog: fix HandlerOptions.ReplaceAttr doc
authorJonathan Amsterdam <jba@google.com>
Tue, 20 Jun 2023 12:55:49 +0000 (08:55 -0400)
committerJonathan Amsterdam <jba@google.com>
Tue, 20 Jun 2023 23:57:50 +0000 (23:57 +0000)
It said that Attrs with an empty key are ignored.
In fact, zero Attrs are ignored.

Fixes #60870.

Change-Id: I221d3a25b0f0cc9001e06e9cc76bab29292c0741
Reviewed-on: https://go-review.googlesource.com/c/go/+/504535
Run-TryBot: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

src/log/slog/handler.go

index 8cd1e563ebd8eb836771d44ec5f3069335a3f2f7..dc4c2d92bd7126cfa27cfef7ca8b95ea31e99b20 100644 (file)
@@ -140,7 +140,7 @@ type HandlerOptions struct {
 
        // ReplaceAttr is called to rewrite each non-group attribute before it is logged.
        // The attribute's value has been resolved (see [Value.Resolve]).
-       // If ReplaceAttr returns an Attr with Key == "", the attribute is discarded.
+       // If ReplaceAttr returns a zero Attr, the attribute is discarded.
        //
        // The built-in attributes with keys "time", "level", "source", and "msg"
        // are passed to this function, except that time is omitted