mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 14:38:29 +01:00
Merge bitcoin/bitcoin#25614: Severity-based logging, step 2
9580480570Update debug logging section in the developer notes (Jon Atack)1abaa31aa3Update -debug and -debugexclude help docs for severity level logging (Jon Atack)45f9282162Create BCLog::Level::Trace log severity level (Jon Atack)2a8712db4fUnit test coverage for -loglevel configuration option (klementtan)eb7bee5f84Create -loglevel configuration option (klementtan)98a1f9c687Unit test coverage for log severity levels (klementtan)9c7507bf76Create BCLog::Logger::LogLevelsString() helper function (klementtan)8fe3457dbbUpdate LogAcceptCategory() and unit tests with log severity levels (klementtan)c2797cfc60Add BCLog::Logger::SetLogLevel()/SetCategoryLogLevel() for string inputs (klementtan)f6c0cc0350Add BCLog::Logger::m_category_log_levels data member and getter/setter (Jon Atack)2978b387bfAdd BCLog::Logger::m_log_level data member and getter/setter (Jon Atack)f1379aeca9Simplify BCLog::Level enum class and LogLevelToStr() function (Jon Atack) Pull request description: This is an updated version of https://github.com/bitcoin/bitcoin/pull/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 the `LogLevelToStr()` 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 ``` $ ./src/bitcoind -help-debug | grep -A10 loglevel -loglevel=<level>|<category>:<level> Set the global or per-category severity level for logging categories enabled with the -debug configuration option or the logging RPC: info, debug, trace (default=info); warning and error levels are always logged. If <category>:<level> is supplied, the setting will override the global one and may be specified multiple times to set multiple category-specific levels. <category> can be: addrman, bench, blockstorage, cmpctblock, coindb, estimatefee, http, i2p, ipc, leveldb, libevent, lock, mempool, mempoolrej, net, proxy, prune, qt, rand, reindex, rpc, selectcoins, tor, util, validation, walletdb, zmq. ``` See the individual commit messages for details. ACKs for top commit: jonatack: One final push per `git range-diffa5d5569ce3c4c9 9580480` (should be trivial to re-ACK) to ensure this pull changes no default behavior in any way for users or the tests/CI in order to be completely v24 compatible, to update the unit test setup in general, and to update the debug logging section in the developer notes. klementtan: reACK95804805701440000bytes: reACK9580480570vasild: ACK9580480570dunxen: reACK9580480brunoerg: reACK9580480570Tree-SHA512: 476a638e0581f40b5d058a9992691722e8b546471ec85e07cbc990798d1197fbffbd02e1b3d081b4978404e07a428378cdc8e159c0004b81f58be7fb01b7cba0
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <i2p.h>
|
||||
#include <logging.h>
|
||||
#include <netaddress.h>
|
||||
#include <test/util/logging.h>
|
||||
#include <test/util/net.h>
|
||||
@@ -19,6 +20,8 @@ BOOST_FIXTURE_TEST_SUITE(i2p_tests, BasicTestingSetup)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(unlimited_recv)
|
||||
{
|
||||
const auto prev_log_level{LogInstance().LogLevel()};
|
||||
LogInstance().SetLogLevel(BCLog::Level::Trace);
|
||||
auto CreateSockOrig = CreateSock;
|
||||
|
||||
// Mock CreateSock() to create MockSock.
|
||||
@@ -39,6 +42,7 @@ BOOST_AUTO_TEST_CASE(unlimited_recv)
|
||||
}
|
||||
|
||||
CreateSock = CreateSockOrig;
|
||||
LogInstance().SetLogLevel(prev_log_level);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
Reference in New Issue
Block a user