Skip to content

Commit

Permalink
SinkDriver: make sink_enabled() const
Browse files Browse the repository at this point in the history
Signed-off-by: Pavel Artsishevsky <polter.rnd@gmail.com>
  • Loading branch information
polter-rnd committed Dec 17, 2024
1 parent b449eba commit fb9b0d1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions include/slimlog/sink-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ auto SinkDriver<Logger, ThreadingPolicy>::remove_sink(const std::shared_ptr<Sink
-> 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;
}
Expand All @@ -110,8 +110,8 @@ auto SinkDriver<Logger, ThreadingPolicy>::set_sink_enabled(
}

template<typename Logger, typename ThreadingPolicy>
auto SinkDriver<Logger, ThreadingPolicy>::sink_enabled(const std::shared_ptr<Sink<Logger>>& sink)
-> bool
auto SinkDriver<Logger, ThreadingPolicy>::sink_enabled(
const std::shared_ptr<Sink<Logger>>& sink) const -> bool
{
const typename ThreadingPolicy::ReadLock lock(m_mutex);
if (const auto itr = m_sinks.find(sink); itr != m_sinks.end()) {
Expand Down
2 changes: 1 addition & 1 deletion include/slimlog/sink.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<Logger>>& sink) -> bool;
auto sink_enabled(const std::shared_ptr<Sink<Logger>>& sink) const -> bool;

/**
* @brief Emits a new callback-based log message if it fits the specified logging level.
Expand Down

0 comments on commit fb9b0d1

Please sign in to comment.