This is an updated version of #25287 and the next steps in parent PR #25203 implementing, with Klement Tan, user-configurable, per-category severity log levels based on an idea by John Newbery and refined in GitHub discussions by Wladimir Van der Laan and Marco Falke.
- simplify the
BCLog::Level
enum class and theLogLevelToStr()
function and add documentation - update the logging logic to filter logs by log level both globally and per-category
- add a hidden
-loglevel
help-debug config option to allow testing setting the global or per-category severity level on startup for logging categories enabled with the-debug
configuration option or the logging RPC (Klement Tan) - add a
trace
log severity level selectable by the user; the plan is for the current debug messages to become trace, LogPrint ones to become debug, and LogPrintf ones to become info, warning, or error
0$ ./src/bitcoind -help-debug | grep -A10 loglevel
1 -loglevel=<level>|<category>:<level>
2 Set the global or per-category severity level for logging categories
3 enabled with the -debug configuration option or the logging RPC:
4 info, debug, trace (default=info); warning and error levels are
5 always logged. If <category>:<level> is supplied, the setting
6 will override the global one and may be specified multiple times
7 to set multiple category-specific levels. <category> can be:
8 addrman, bench, blockstorage, cmpctblock, coindb, estimatefee,
9 http, i2p, ipc, leveldb, libevent, lock, mempool, mempoolrej,
10 net, proxy, prune, qt, rand, reindex, rpc, selectcoins, tor,
11 util, validation, walletdb, zmq.
See the individual commit messages for details.