log: avoid setting default slog logger in init (#28747)

slog.SetDefault has undesirable side effects. It also sets the default logger destination,
for example. So we should not call it by default in init.
pull/28755/head
Felix Lange 11 months ago committed by GitHub
parent 76a5474b32
commit c053eb71b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      log/root.go

@ -10,8 +10,7 @@ import (
var root atomic.Value var root atomic.Value
func init() { func init() {
defaultLogger := &logger{slog.New(DiscardHandler())} root.Store(&logger{slog.New(DiscardHandler())})
SetDefault(defaultLogger)
} }
// SetDefault sets the default global logger // SetDefault sets the default global logger

Loading…
Cancel
Save