1
0
Fork 0
forked from forks/go-ethereum
go-ethereum-modded-tocallarg/internal
jwasinger f64aa6eaf7
internal/testlog: fix log output from sub-loggers (#31539)
When we instantiate a sub-logger via
`go-ethereum/internal/testlog/logger.With`, we copy the reference to the
`bufHandler` from the parent logger. However, internally,
`go-ethereum/internal/testlog/logger.With` calls `log/slog/Logger.With`
which creates a new handler instance (via
`internal/bufHandler.WithAttrs`).

This PR modifies sub-logger instantiation to use the newly-instantiated
handler, instead of copying the reference from the parent instance. The
type cast from `slog.Handler` to `*bufHandler` in
`internal/testlog/Logger.With` is safe here because a
`internal/testlog/Logger` can only be instantiated with a `*bufHandler`
as the underlying handler type.

Note, that I've also removed a pre-existing method that broke the above
assumption. However, this method is not used in our codebase.

I'm not sure if the assumption holds for forks of geth (e.g. optimism
has modified the testlogger somewhat allowing test loggers to accept
arbitrary handler types), but it seems okay to break API compatibility
given that this is in the `internal` package.

closes https://github.com/ethereum/go-ethereum/issues/31533
2025-04-10 18:21:32 +02:00
..
blocktest internal/blocktest: add package for shared test code (#27270) 2023-07-11 14:57:02 +02:00
build appveyor, build, internal: ci.go cleanups, add package dep checker (#30696) 2024-10-29 13:21:17 +02:00
cmdtest all: make vendored copy of reexec (#28382) 2023-10-28 00:14:43 +02:00
debug internal/debug: rename --trace to --go-execution-trace (#30846) 2024-12-02 18:17:43 +01:00
era internal/era: random access to header and receipts (#31544) 2025-04-04 06:07:46 -06:00
ethapi eth: fix calls to HistoryPruningCutoff (#31552) 2025-04-03 15:44:07 +02:00
flags cmd/workload: RPC workload tests for filters and history (#31189) 2025-02-27 00:07:14 +01:00
guide all: fix typos in docs and comments (#31548) 2025-04-02 13:52:40 -06:00
jsre all: fix some typos in comments and names (#31023) 2025-01-14 14:16:15 +01:00
reexec all: fix some typos in comments and names (#31023) 2025-01-14 14:16:15 +01:00
shutdowncheck eth, les: update unclean shutdown markers regularly (#24077) 2021-12-17 15:18:51 +01:00
syncx core: improve shutdown synchronization in BlockChain (#22853) 2021-10-07 15:47:50 +02:00
testlog internal/testlog: fix log output from sub-loggers (#31539) 2025-04-10 18:21:32 +02:00
testrand triedb/pathdb: improve tests (#29278) 2024-03-19 10:50:08 +08:00
utesting internal: run tests in parallel (#30381) 2024-09-16 08:44:47 +02:00
version build, internal, version: break ci.go/version->common dependency (#30638) 2024-10-20 19:28:39 +03:00
web3ext internal/ethapi: add block override to estimateGas (#30695) 2024-12-12 12:39:03 +01:00