go-ethereum/cmd/geth
jwasinger 28e7371701
all: replace log15 with slog (#28187)
This PR replaces Geth's logger package (a fork of [log15](https://github.com/inconshreveable/log15)) with an implementation using slog, a logging library included as part of the Go standard library as of Go1.21.

Main changes are as follows:
* removes any log handlers that were unused in the Geth codebase.
* Json, logfmt, and terminal formatters are now slog handlers.
* Verbosity level constants are changed to match slog constant values.  Internal translation is done to make this opaque to the user and backwards compatible with existing `--verbosity` and `--vmodule` options.
* `--log.backtraceat` and `--log.debug` are removed.

The external-facing API is largely the same as the existing Geth logger.  Logger method signatures remain unchanged.

A small semantic difference is that a `Handler` can only be set once per `Logger` and not changed dynamically.  This just means that a new logger must be instantiated every time the handler of the root logger is changed.

----
For users of the `go-ethereum/log` module. If you were using this module for your own project, you will need to change the initialization. If you previously did 
```golang
log.Root().SetHandler(log.LvlFilterHandler(log.LvlInfo, log.StreamHandler(os.Stderr, log.TerminalFormat(true))))
```
You now instead need to do 
```golang
log.SetDefault(log.NewLogger(log.NewTerminalHandlerWithLevel(os.Stderr, log.LevelInfo, true)))
```
See more about reasoning here: https://github.com/ethereum/go-ethereum/issues/28558#issuecomment-1820606613
2023-11-29 08:33:50 +01:00
..
testdata all: replace log15 with slog (#28187) 2023-11-29 08:33:50 +01:00
accountcmd.go cmd/geth: make account commands not require datadir lock (#27084) 2023-04-27 06:57:29 -04:00
accountcmd_test.go cmd: run tests in parallel (#28546) 2023-11-20 10:52:14 +01:00
attach_test.go cmd/geth: atomic types used (#27756) 2023-07-24 13:22:54 +03:00
chaincmd.go cmd/evm, core/state: fix post-exec dump of state (statetests, blockchaintests) (#28504) 2023-11-28 13:54:17 +01:00
config.go cmd, les, tests: remove light client code (#28586) 2023-11-23 16:28:26 +02:00
consolecmd.go node: remove unused error return from Attach (#27450) 2023-06-14 08:24:47 -04:00
consolecmd_test.go cmd: run tests in parallel (#28546) 2023-11-20 10:52:14 +01:00
dbcmd.go cmd, core, trie: verkle-capable `geth init` (#28270) 2023-11-14 13:09:40 +01:00
exportcmd_test.go cmd: run tests in parallel (#28546) 2023-11-20 10:52:14 +01:00
genesis_test.go cmd/geth: fix failing test (#28322) 2023-10-12 09:54:00 +02:00
logging_test.go all: replace log15 with slog (#28187) 2023-11-29 08:33:50 +01:00
logtestcmd_active.go all: replace log15 with slog (#28187) 2023-11-29 08:33:50 +01:00
logtestcmd_inactive.go cmd/geth: test for logging-output (#28373) 2023-10-25 17:57:12 +02:00
main.go all: replace log15 with slog (#28187) 2023-11-29 08:33:50 +01:00
misccmd.go all: remove ethash pow, only retain shims needed for consensus and tests (#27178) 2023-05-03 12:58:39 +03:00
run_test.go cmd, les, tests: remove light client code (#28586) 2023-11-23 16:28:26 +02:00
snapshot.go cmd/evm, core/state: fix post-exec dump of state (statetests, blockchaintests) (#28504) 2023-11-28 13:54:17 +01:00
verkle.go cmd, core, trie: verkle-capable `geth init` (#28270) 2023-11-14 13:09:40 +01:00
version_check.go cmd: migrate to urfave/cli/v2 (#24751) 2022-06-27 18:22:36 +02:00
version_check_test.go cmd: run tests in parallel (#28546) 2023-11-20 10:52:14 +01:00