go-ethereum/log
Felix Lange 552c033e64 log: simplify pc level cache and fix bug in WithAttrs
Updates the Handle path to perform a single atomic load and no locking.
This is done by storing all state required for level matching into a single
struct and replacing that struct entirely whenever patterns or the global level
change.

Also fixes an issue with the current implementation where WithAttrs would return a fully
independent copy of the handler, with its own level. The WithAttrs method is calledd by
slog.Logger.With, which we also use in go-ethereum to create context specific loggers with
pre-filled attributes. Under the previous implementation of WithAttrs, if the application
created a long-lived logger (for example, for a specific peer), then that logger would not
be affected by later level changes done on the top-level logger, leading to potentially
missed events.
2026-04-15 11:14:56 +02:00
..
format.go log: remove unused parameter (#30432) 2024-10-08 13:30:07 +02:00
format_test.go log: using testing.B.Loop (#32663) 2025-09-19 17:05:21 -06: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: simplify pc level cache and fix bug in WithAttrs 2026-04-15 11:14:56 +02:00
logger.go log: fix some functions comments (#29907) 2024-06-17 11:03:27 +02:00
logger_test.go log: cache default level when no vmodule patterns configured and add downgrade test 2026-02-19 10:43:31 -07: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