Commit Graph

15 Commits

Author SHA1 Message Date
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
s7v7nislands
7caa2d8163
all: replace strings.Replace with string.ReplaceAll (#24835) 2022-05-09 13:13:23 +03:00
Péter Szilágyi
9bf495bfc9
internal/debug: make gosimple linter happy 2021-09-20 18:55:35 +03:00
Péter Szilágyi
e28f713ada
internal: support optional filter expression for debug.stacks (#23605)
* internal: support optional filter expression for debug.stacks

* internal/debug: fix string regexp

* internal/debug: support searching for line numbers too
2021-09-20 16:29:07 +03:00
mr_franklin
4ee11b072e
cmd/bootnode,internal/debug: fix some comments (#21623) 2020-09-29 11:31:14 +02:00
Ryan Schneider
897ea01d5f internal/debug: use pprof goroutine writer for debug_stacks (#16892)
* debug: Use pprof goroutine writer in debug.Stacks() to ensure all goroutines are captured.

* Up to 64MB limit, previous code only captured first 1MB of goroutines.

* internal/debug: simplify stacks handler

* fix typo

* fix pointer receiver
2018-06-14 16:58:44 +03:00
Felix Lange
12f4d28411
internal/debug: add support for mutex profiles (#16230) 2018-03-03 00:52:21 +01:00
Felix Lange
48705f8aea internal/debug: add debug_setGCPercent 2017-09-11 12:29:47 +02:00
Felix Lange
5596b664c4 internal/debug: add debug_freeOSMemory (#15122) 2017-09-11 09:33:18 +02:00
Péter Szilágyi
e7030c4bf5
all: update light logs (and a few others) to the new model 2017-03-03 11:41:52 +02:00
Péter Szilágyi
d4fd06c3dc
all: blidly swap out glog to our log15, logs need rework 2017-02-23 12:16:44 +02:00
Felix Lange
ae9ed5c420 internal/debug: also rename debug_startTrace to debug_startGoTrace
This was missing from the previous change.
2016-05-06 11:15:05 +02:00
Felix Lange
844e911129 internal/debug: rename debug_trace to debug_goTrace
Reduces confusion with EVM execution tracing methods.
2016-05-06 10:27:24 +02:00
Felix Lange
bea56d84e5 internal/debug: add memStats and gcStats to API 2016-04-13 12:08:07 +02:00
Felix Lange
3750d835a1 internal/debug: APIs for profiling and tracing
The debug package provides an RPC wrapper for glog settings and the
debugging facilities of the Go runtime. They can be triggered through
both command line flags and the IPC listener.
2016-01-28 13:36:11 +01:00