From fb9b0d1d3700f61294109ecaf36de56eec065966 Mon Sep 17 00:00:00 2001 From: Pavel Artsishevsky Date: Tue, 17 Dec 2024 21:03:59 +0100 Subject: [PATCH] SinkDriver: make sink_enabled() const Signed-off-by: Pavel Artsishevsky --- include/slimlog/sink-inl.h | 6 +++--- include/slimlog/sink.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/slimlog/sink-inl.h b/include/slimlog/sink-inl.h index 96efdfc..ee2ac96 100644 --- a/include/slimlog/sink-inl.h +++ b/include/slimlog/sink-inl.h @@ -89,7 +89,7 @@ auto SinkDriver::remove_sink(const std::shared_ptr bool { const typename ThreadingPolicy::WriteLock lock(m_mutex); - if (m_sinks.erase(sink) == 1) { + if (m_sinks.erase(sink) > 0) { update_effective_sinks(); return true; } @@ -110,8 +110,8 @@ auto SinkDriver::set_sink_enabled( } template -auto SinkDriver::sink_enabled(const std::shared_ptr>& sink) - -> bool +auto SinkDriver::sink_enabled( + const std::shared_ptr>& sink) const -> bool { const typename ThreadingPolicy::ReadLock lock(m_mutex); if (const auto itr = m_sinks.find(sink); itr != m_sinks.end()) { diff --git a/include/slimlog/sink.h b/include/slimlog/sink.h index 3c25090..4ea0dc1 100644 --- a/include/slimlog/sink.h +++ b/include/slimlog/sink.h @@ -229,7 +229,7 @@ class SinkDriver final { * @return \b true if the sink is enabled. * @return \b false if the sink is disabled. */ - auto sink_enabled(const std::shared_ptr>& sink) -> bool; + auto sink_enabled(const std::shared_ptr>& sink) const -> bool; /** * @brief Emits a new callback-based log message if it fits the specified logging level.