mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-05-28 23:09:23 +02:00
util/log: Rename LogPrintLevel_ into detail_ namespace
After the previous commit, LogPrintLevel_ is only used to implement other macros.
This commit is contained in:
@@ -112,15 +112,15 @@ using Level = util::log::Level;
|
||||
|
||||
// Allow __func__ to be used in any context without warnings:
|
||||
// NOLINTNEXTLINE(bugprone-lambda-function-name)
|
||||
#define LogPrintLevel_(category, level, ...) util::log::LogPrintFormatInternal(SourceLocation{__func__}, category, level, __VA_ARGS__)
|
||||
#define detail_LogWithSrcLoc(category, level, ...) util::log::LogPrintFormatInternal(SourceLocation{__func__}, category, level, __VA_ARGS__)
|
||||
|
||||
// Log unconditionally. Uses basic rate limiting to mitigate disk filling attacks.
|
||||
// Be conservative when using functions that unconditionally log to debug.log!
|
||||
// It should not be the case that an inbound peer can fill up a user's storage
|
||||
// with debug.log entries.
|
||||
#define LogInfo(...) LogPrintLevel_(BCLog::LogFlags::ALL, util::log::Level::Info, __VA_ARGS__)
|
||||
#define LogWarning(...) LogPrintLevel_(BCLog::LogFlags::ALL, util::log::Level::Warning, __VA_ARGS__)
|
||||
#define LogError(...) LogPrintLevel_(BCLog::LogFlags::ALL, util::log::Level::Error, __VA_ARGS__)
|
||||
#define LogInfo(...) detail_LogWithSrcLoc(BCLog::LogFlags::ALL, util::log::Level::Info, __VA_ARGS__)
|
||||
#define LogWarning(...) detail_LogWithSrcLoc(BCLog::LogFlags::ALL, util::log::Level::Warning, __VA_ARGS__)
|
||||
#define LogError(...) detail_LogWithSrcLoc(BCLog::LogFlags::ALL, util::log::Level::Error, __VA_ARGS__)
|
||||
|
||||
// Use a macro instead of a function for conditional logging to prevent
|
||||
// evaluating arguments when logging for the category is not enabled.
|
||||
@@ -132,7 +132,7 @@ using Level = util::log::Level;
|
||||
do { \
|
||||
if (util::log::ShouldLog((category), (level))) { \
|
||||
Assume((level) < util::log::Level::Info); /*Only called with the levels below*/ \
|
||||
LogPrintLevel_((category), (level), util::log::NO_RATE_LIMIT, __VA_ARGS__); \
|
||||
detail_LogWithSrcLoc((category), (level), util::log::NO_RATE_LIMIT, __VA_ARGS__); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user