refactor: logging: Various API improvements#34806
Open
ajtowns wants to merge 8 commits intobitcoin:masterfrom
Open
refactor: logging: Various API improvements#34806ajtowns wants to merge 8 commits intobitcoin:masterfrom
ajtowns wants to merge 8 commits intobitcoin:masterfrom
Conversation
We should not be logging while shrinking the debug file, so make sure that's true by using our mutex.
After the previous commit, LogPrintLevel_ is only used to implement other macros.
…of a generic ShouldLog
-BEGIN VERIFY SCRIPT- sed -i 's/LogAcceptCategory(\(.*\), [a-zA-Z:]*::Level::Debug)/util::log::ShouldDebugLog(\1)/g' $(git grep -l LogAcceptCategory -- '*.cpp') sed -i 's/LogAcceptCategory(\(.*\), [a-zA-Z:]*::Level::Trace)/util::log::ShouldTraceLog(\1)/g' $(git grep -l LogAcceptCategory -- '*.cpp') sed -i '/Return true if log accepts specified category/,/^$/d' src/logging.h -END VERIFY SCRIPT-
Add missing includes of logging.h in preparation for the next commit, switching to util/log.h. Also removes some unnecessary util/check.h includes that CI complains about.
Replace usage of logging.h with util/log.h where it suffices.
Contributor
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ReviewsSee the guideline for information on the review process. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
Contributor
Author
|
Split off from #34038 |
This was referenced Mar 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ShrinkDebugFilenow takes the logging mutex for its entire run; though it's only called in init so shouldn't have any races in the first place.Adds a
NO_RATE_LIMITtag that can be used with info/warning/error logs to avoid rate-limiting. This allowsLogPrintLevel_to be restricted to being an internal API.The
GetLogCategoryfunction is moved out of the global namespace.ShouldLogis split into separateShouldDebugLogandShouldTraceLogso that filtering checks are somewhat more enforced via function signature checks.Redundant
LogAcceptCategoryfunction is removed.More files are pointed at util/log.h instead of logging.h.