aboutsummaryrefslogtreecommitdiff
path: root/src/logging.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/logging.h')
-rw-r--r--src/logging.h16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/logging.h b/src/logging.h
index c27a71168b..7a1c25233a 100644
--- a/src/logging.h
+++ b/src/logging.h
@@ -23,8 +23,6 @@ extern const char * const DEFAULT_DEBUGLOGFILE;
extern bool fLogIPs;
-extern std::atomic<uint32_t> logCategories;
-
struct CLogCategoryActive
{
std::string category;
@@ -72,6 +70,9 @@ namespace BCLog {
*/
std::atomic_bool fStartedNewLine{true};
+ /** Log categories bitfield. */
+ std::atomic<uint32_t> logCategories{0};
+
std::string LogTimestampStr(const std::string& str);
public:
@@ -92,6 +93,13 @@ namespace BCLog {
fs::path GetDebugLogPath() const;
bool OpenDebugLog();
void ShrinkDebugFile();
+
+ uint32_t GetCategoryMask() const { return logCategories.load(); }
+ void EnableCategory(LogFlags flag);
+ void DisableCategory(LogFlags flag);
+ bool WillLogCategory(LogFlags category) const;
+
+ bool DefaultShrinkDebugFile() const;
};
} // namespace BCLog
@@ -99,9 +107,9 @@ namespace BCLog {
extern BCLog::Logger* const g_logger;
/** Return true if log accepts specified category */
-static inline bool LogAcceptCategory(uint32_t category)
+static inline bool LogAcceptCategory(BCLog::LogFlags category)
{
- return (logCategories.load(std::memory_order_relaxed) & category) != 0;
+ return g_logger->WillLogCategory(category);
}
/** Returns a string with the log categories. */