Skip to content

Commit

Permalink
log: avoid setting default slog logger in init (ethereum#28747)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
fjl authored Dec 30, 2023
1 parent 76a5474 commit c053eb7
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions log/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ import (
var root atomic.Value

func init() {
defaultLogger := &logger{slog.New(DiscardHandler())}
SetDefault(defaultLogger)
root.Store(&logger{slog.New(DiscardHandler())})
}

// SetDefault sets the default global logger
Expand Down

0 comments on commit c053eb7

Please sign in to comment.