aboutsummaryrefslogtreecommitdiff
path: root/src/logging.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/logging.cpp')
-rw-r--r--src/logging.cpp23
1 files changed, 20 insertions, 3 deletions
diff --git a/src/logging.cpp b/src/logging.cpp
index ed225a6a67..7604c0fd94 100644
--- a/src/logging.cpp
+++ b/src/logging.cpp
@@ -26,9 +26,6 @@ BCLog::Logger* const g_logger = new BCLog::Logger();
bool fLogIPs = DEFAULT_LOGIPS;
-/** Log categories bitfield. */
-std::atomic<uint32_t> logCategories(0);
-
static int FileWriteStr(const std::string &str, FILE *fp)
{
return fwrite(str.data(), 1, str.size(), fp);
@@ -62,6 +59,26 @@ bool BCLog::Logger::OpenDebugLog()
return true;
}
+void BCLog::Logger::EnableCategory(BCLog::LogFlags flag)
+{
+ logCategories |= flag;
+}
+
+void BCLog::Logger::DisableCategory(BCLog::LogFlags flag)
+{
+ logCategories &= ~flag;
+}
+
+bool BCLog::Logger::WillLogCategory(BCLog::LogFlags category) const
+{
+ return (logCategories.load(std::memory_order_relaxed) & category) != 0;
+}
+
+bool BCLog::Logger::DefaultShrinkDebugFile() const
+{
+ return logCategories == BCLog::NONE;
+}
+
struct CLogCategoryDesc
{
uint32_t flag;