go-ethereum/log
Stephen Buttolph 51177ed8c5
log: fix SetDefault for custom loggers (#31368)
Currently, even though it takes in a `Logger` interface,
`log.SetDefualt` enforces that the concrete type of the provided logger
is `*logger` because:
1. in `init` `root.Store` is called with a `*logger`
2. `atomic.Value` panics if the concrete type provided in `Store` is not
consistent across calls.
([ref](https://pkg.go.dev/sync/atomic#Value.Store))

> All calls to Store for a given Value must use values of the same
concrete type.

This PR changes to use `sync.RWMutex` and adds a test that panics on
`master`.
2025-03-14 16:56:53 +01:00
..
format.go log: remove unused parameter (#30432) 2024-10-08 13:30:07 +02:00
format_test.go slog: faster and less memory-consumption (#28621) 2023-12-01 13:28:20 +01:00
handler.go all: fix inconsistent receiver name and add lint rule for it (#29974) 2024-06-12 10:45:42 +03:00
handler_glog.go log: fix some functions comments (#29907) 2024-06-17 11:03:27 +02:00
logger.go log: fix some functions comments (#29907) 2024-06-17 11:03:27 +02:00
logger_test.go all: fix issues with benchmarks (#30667) 2024-11-04 15:10:12 +01:00
root.go log: fix SetDefault for custom loggers (#31368) 2025-03-14 16:56:53 +01:00
root_test.go log: fix SetDefault for custom loggers (#31368) 2025-03-14 16:56:53 +01:00