aboutsummaryrefslogtreecommitdiff
path: root/src/logging.h
diff options
context:
space:
mode:
authorklementtan <klementtan@gmail.com>2022-08-18 13:37:25 +0200
committerJon Atack <jon@atack.com>2022-08-20 11:30:51 +0200
commit8fe3457dbb4146952b92fb9509bbe4e97dc1f05b (patch)
tree24617cf6f48b6a1e68b3ee605d5af56caf27be3d /src/logging.h
parentc2797cfc602c5cdd899a7c11b37bb5711cebff38 (diff)
downloadbitcoin-8fe3457dbb4146952b92fb9509bbe4e97dc1f05b.tar.xz
Update LogAcceptCategory() and unit tests with log severity levels
Co-authored-by: "Jon Atack <jon@atack.com>"
Diffstat (limited to 'src/logging.h')
-rw-r--r--src/logging.h9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/logging.h b/src/logging.h
index f49a2db326..76bed39e91 100644
--- a/src/logging.h
+++ b/src/logging.h
@@ -176,6 +176,8 @@ namespace BCLog {
bool DisableCategory(const std::string& str);
bool WillLogCategory(LogFlags category) const;
+ bool WillLogCategoryLevel(LogFlags category, Level level) const;
+
/** Returns a vector of the log categories in alphabetical order. */
std::vector<LogCategory> LogCategoriesList() const;
/** Returns a string with the log categories in alphabetical order. */
@@ -194,12 +196,7 @@ BCLog::Logger& LogInstance();
/** Return true if log accepts specified category, at the specified level. */
static inline bool LogAcceptCategory(BCLog::LogFlags category, BCLog::Level level)
{
- // Log messages at Warning and Error level unconditionally, so that
- // important troubleshooting information doesn't get lost.
- if (level >= BCLog::Level::Warning) {
- return true;
- }
- return LogInstance().WillLogCategory(category);
+ return LogInstance().WillLogCategoryLevel(category, level);
}
/** Return true if str parses as a log category and set the flag */