go-ethereum/p2p
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
..
discover all: replace log15 with slog (#28187) 2023-11-29 08:33:50 +01:00
dnsdisc all: update golang/x/ext and fix slice sorting fallout (#27909) 2023-08-12 00:04:12 +02:00
enode p2p: initialize maps with known size (#27229) 2023-05-10 10:52:26 +02:00
enr p2p/discover: improve discv5 NODES response packing (#26033) 2022-11-07 19:19:02 +01:00
msgrate p2p: initialize maps with known size (#27229) 2023-05-10 10:52:26 +02:00
nat all: replace some cases of strings.SplitN with strings.Cut (#28446) 2023-11-15 14:42:33 +01:00
netutil p2p: initialize maps with known size (#27229) 2023-05-10 10:52:26 +02:00
nodestate p2p: initialize maps with known size (#27229) 2023-05-10 10:52:26 +02:00
rlpx all: update license headers and AUTHORS from git history (#24947) 2022-05-24 20:39:40 +02:00
simulations all: replace log15 with slog (#28187) 2023-11-29 08:33:50 +01:00
tracker all: fix some typos (#25551) 2022-08-19 09:00:21 +03:00
dial_test.go p2p: initialize maps with known size (#27229) 2023-05-10 10:52:26 +02:00
dial.go p2p, p2p/discover: add dial metrics (#27621) 2023-07-06 16:20:31 +02:00
message_test.go p2p: move rlpx into separate package (#21464) 2020-09-22 10:17:39 +02:00
message.go p2p: use atomic types (#27764) 2023-08-01 23:20:52 +02:00
metrics.go p2p, p2p/discover: add dial metrics (#27621) 2023-07-06 16:20:31 +02:00
peer_error.go p2p: use errors.Is for error comparison (#24882) 2022-06-07 17:27:21 +02:00
peer_test.go p2p: move rlpx into separate package (#21464) 2020-09-22 10:17:39 +02:00
peer.go all: update golang/x/ext and fix slice sorting fallout (#27909) 2023-08-12 00:04:12 +02:00
protocol.go all: update golang/x/ext and fix slice sorting fallout (#27909) 2023-08-12 00:04:12 +02:00
server_nat_test.go cmd/bootnode, p2p: support for alternate mapped ports (#26359) 2023-07-14 14:58:27 +02:00
server_nat.go cmd/bootnode, p2p: support for alternate mapped ports (#26359) 2023-07-14 14:58:27 +02:00
server_test.go cmd/bootnode, p2p: support for alternate mapped ports (#26359) 2023-07-14 14:58:27 +02:00
server.go all: update golang/x/ext and fix slice sorting fallout (#27909) 2023-08-12 00:04:12 +02:00
transport_test.go all: update license headers and AUTHORS from git history (#24947) 2022-05-24 20:39:40 +02:00
transport.go all: update license headers and AUTHORS from git history (#24947) 2022-05-24 20:39:40 +02:00
util_test.go p2p: new dial scheduler (#20592) 2020-02-13 11:10:03 +01:00
util.go all: assign zero after resize in implementations of heap.Interface (#26296) 2022-12-05 13:49:54 +01:00