aboutsummaryrefslogtreecommitdiff
path: root/src/logging.h
diff options
context:
space:
mode:
authorJon Atack <jon@atack.com>2022-08-18 12:02:26 +0200
committerJon Atack <jon@atack.com>2022-08-20 11:30:35 +0200
commit2978b387bffc226fb1eaca4d30f24a0deedb2a36 (patch)
tree7fcb09268d8f2dd08737b01b09e97f5a15743507 /src/logging.h
parentf1379aeca9d3a8c4d3528de4d0af8298cb42fee4 (diff)
downloadbitcoin-2978b387bffc226fb1eaca4d30f24a0deedb2a36.tar.xz
Add BCLog::Logger::m_log_level data member and getter/setter
Co-authored-by: "klementtan <klementtan@gmail.com>"
Diffstat (limited to 'src/logging.h')
-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);