1 minor finding · 4 suggestions
Earlier concerns neither republished nor resolved: 1 minor finding. See the Run archive for their assessments.
Findings
[minor] · -loglevelalways loses Info labels and higher-level categories
With the non-default -loglevelalways=1 option, Info messages lose their severity/category prefix, while Warning and Error messages lose the category, contrary to the option's documented behavior.
Location: src/logging.cpp:359 (head).
Details and suggested fix
The new level <= Level::Debug guard makes has_category false at Info and above even when m_always_print_category_level is true. Info messages therefore return an empty severity/category prefix instead of [all:info] , and Warning/Error messages use [warning] and [error] instead of [all:warning] and [all:error] . Normalize categories to LogFlags::ALL above Debug, then retain the previous m_always_print_category_level || category != LogFlags::ALL expression. This keeps context-specific categories out of higher-level output and preserves default formatting while honoring the explicit option. Add a formatting test with the flag enabled.
Optional improvements
[suggestion] · Disabled-category Debug/Trace calls now take the logger mutex
The BCLog backend now locks the logger even when a Debug/Trace category is disabled, adding synchronization to previously lock-free discarded calls.
Location: src/logging.cpp:625 (head).
Details and suggested fix
hooks::ShouldLog calls Enabled(), which locks m_cs, before WillLogCategoryLevel() can reject a disabled category using its relaxed atomic load. This affects frequent calls such as the received-message log in net_processing.cpp, including under default settings. These discarded calls can now wait behind console output, callbacks, or file writes holding the same mutex. Check WillLogCategoryLevel() before Enabled() to restore the disabled-category fast path while retaining both filtering requirements and skipped formatting when output is disabled. The size of the performance effect has not been measured.
[suggestion] · Fatal wallet-load diagnostics remain at Info
The severity conversion labels noncritical record errors as Error but leaves several diagnostics for aborted wallet loads at Info, so filtering for [error] omits those details.
Location: src/wallet/walletdb.cpp:1218 (head).
Details and suggested fix
The std::runtime_error catch in WalletBatch::LoadWallet still uses LogInfo before returning CORRUPT. The guarded master-key erase, decrypted-features erase, and version/features write failures likewise remain Info before returning CORRUPT or LOAD_FAIL. Meanwhile, LoadRecords now uses LogError for every non-OK record result, including NONCRITICAL_ERROR, which the loading caller permits. Switch these fatal-load diagnostics to LogError as part of the severity conversion; the tx-update write failure in CWallet::AddToWallet has the same omission. This is a logging-classification suggestion: these messages were already Info at base, and wallet load, recovery, and acceptance behavior remain unchanged.
[suggestion] · WalletLogContext defaults future Debug/Trace calls to ALL
Future Debug/Trace calls using the wallet context would pass category filtering whenever any category remains enabled, rather than being selectable as wallet logging.
Location: src/wallet/logging.h:19 (head).
Details and suggested fix
WalletLogContext default-constructs its Context base with category ALL, and passing that context satisfies the Debug/Trace category requirement. A future LogDebug(wallet.Log(), ...) would therefore pass the category check under an unrelated option such as -debug=net, subject to output and level checks. Excluding a wallet category would not silence it while another category remained enabled, and wallet-specific level overrides would not apply. With default prefix settings, it would also lack a category name. Give the context an explicit logging category, for example through a required constructor parameter, so callers can select an appropriate category. No current wallet-context Debug/Trace caller was found; the converted Info/Warning/Error calls are unaffected, and the choice of a general wallet category remains open.
[suggestion] · wallet/logging.h relies on a transitive declaration of std::move
The new header uses std::move without including <utility>, leaving its dependency implicit and vulnerable to changes in indirect includes.
Location: src/wallet/logging.h:19 (head).
Details and suggested fix
WalletLogContext calls std::move(display_name), but the header directly includes only <logging.h> and <string>. Add #include <utility> so the header includes the declaration it uses, as required by the direct-include convention in developer-notes.
Earlier concerns
Earlier reports raised these, with the titles and severities shown there. This review neither republished nor resolved them.
- [minor]: The first logging argument can be evaluated twice