aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/logging.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/logging.h b/src/logging.h
index f3914958cf..e6cf451b55 100644
--- a/src/logging.h
+++ b/src/logging.h
@@ -74,6 +74,7 @@ namespace BCLog {
Error,
None, // Internal use only
};
+ constexpr auto DEFAULT_LOG_LEVEL{Level::Debug};
class Logger
{
@@ -91,6 +92,10 @@ namespace BCLog {
*/
std::atomic_bool m_started_new_line{true};
+ //! If there is no category-specific log level, all logs with a severity
+ //! level lower than `m_log_level` will be ignored.
+ std::atomic<Level> m_log_level{DEFAULT_LOG_LEVEL};
+
/** Log categories bitfield. */
std::atomic<uint32_t> m_categories{0};
@@ -143,6 +148,9 @@ namespace BCLog {
void ShrinkDebugFile();
+ Level LogLevel() const { return m_log_level.load(); }
+ void SetLogLevel(Level level) { m_log_level = level; }
+
uint32_t GetCategoryMask() const { return m_categories.load(); }
void EnableCategory(LogFlags flag);