log/slog: handler.Enabled should be called with context.Background()
instead of nil
ctx
#61457
Labels
context.Background()
instead of nil
ctx
#61457
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What did you do?
Look at the source code: https://cs.opensource.google/go/go/+/refs/tags/go1.21rc2:src/log/slog/logger.go;l=209-210
What did you expect to see?
This
if
must be executed before callingl.Enabled(ctx)
: https://cs.opensource.google/go/go/+/refs/tags/go1.21rc2:src/log/slog/logger.go;l=222-224What did you see instead?
Current implementation violates current doc. https://pkg.go.dev/log/slog#Handler says:
The text was updated successfully, but these errors were encountered: