Skip to content

Commit fc684ad

Browse files
fjlDergarcon
authored andcommitted
log: avoid setting default slog logger in init (ethereum#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.
1 parent d1eabd8 commit fc684ad

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

log/root.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ import (
1010
var root atomic.Value
1111

1212
func init() {
13-
defaultLogger := &logger{slog.New(DiscardHandler())}
14-
SetDefault(defaultLogger)
13+
root.Store(&logger{slog.New(DiscardHandler())})
1514
}
1615

1716
// SetDefault sets the default global logger

0 commit comments

Comments
 (0)