aboutsummaryrefslogtreecommitdiff
path: root/src/logging.h
diff options
context:
space:
mode:
authorJon Atack <jon@atack.com>2022-05-25 18:26:54 +0200
committerJon Atack <jon@atack.com>2022-06-08 14:02:54 +0200
commiteb8aab759fb15824a5dd3004e689d0eb5b884a32 (patch)
tree3dc6ec7fdb4199a4d5115a016355834f23c50a83 /src/logging.h
parentb9416c3847cd347238a9d75d949327f69e187d79 (diff)
logging: add LogPrintfCategory to log unconditionally with category
prefixing the output with the passed category name. - add documentation - add a unit test - update lint-logs.py - update lint-format-strings.py
Diffstat (limited to 'src/logging.h')
-rw-r--r--src/logging.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/logging.h b/src/logging.h
index 8a896b6b33..50869ad89a 100644
--- a/src/logging.h
+++ b/src/logging.h
@@ -199,13 +199,18 @@ static inline void LogPrintf_(const std::string& logging_function, const std::st
}
}
-
#define LogPrintLevel_(category, level, ...) LogPrintf_(__func__, __FILE__, __LINE__, category, level, __VA_ARGS__)
+// Log unconditionally.
#define LogPrintf(...) LogPrintLevel_(BCLog::LogFlags::NONE, BCLog::Level::None, __VA_ARGS__)
+// Log unconditionally, prefixing the output with the passed category name.
+#define LogPrintfCategory(category, ...) LogPrintLevel_(category, BCLog::Level::None, __VA_ARGS__)
+
// Use a macro instead of a function for conditional logging to prevent
// evaluating arguments when logging for the category is not enabled.
+
+// Log conditionally, prefixing the output with the passed category name.
#define LogPrint(category, ...) \
do { \
if (LogAcceptCategory((category), BCLog::Level::Debug)) { \
@@ -213,6 +218,7 @@ static inline void LogPrintf_(const std::string& logging_function, const std::st
} \
} while (0)
+// Log conditionally, prefixing the output with the passed category name and severity level.
#define LogPrintLevel(category, level, ...) \
do { \
if (LogAcceptCategory((category), (level))) { \