Overview: This PR allows logs below the threshold severity level to be ignored (a continuation of #24464).
Notable changes:
- Deduplicate identical code in
LogCategoryToStr
andLogCategories
(addresses #24464 (review)) - Threshold log level:
- Introduce a global threshold log level that will allow the logger to ignore logs that are below the threshold level (defaults to
Levels::info
)- User can configure this with
-loglevel=<level>
(ie:-loglevel=warning
)
- User can configure this with
- Introduce a category-specific threshold log level that overrides the global threshold log level. Category-specific log level will only apply to the category supplied in the configuration
- User can configure this with
-loglevel=<category>:<level>
(ie:-loglevel=net:warning
)
- User can configure this with
- Introduce a global threshold log level that will allow the logger to ignore logs that are below the threshold level (defaults to
Testing:
Global log level:
0# global log level = info (default)
1$ ./src/bitcoind -signet
2$ grep -o "net:debug" ~/.bitcoin/signet/debug.log | wc -l
30
4
5# global log level = debug
6$ ./src/bitcoind -signet -loglevel=debug
7$ grep -o "net:debug" ~/.bitcoin/signet/debug.log | wc -l
84