1
0
mirror of https://github.com/gabime/spdlog.git synced 2025-04-01 02:42:41 +08:00

Added [[nodiscard]] and made should_flush_ const

This commit is contained in:
gabime 2024-11-29 16:11:13 +02:00
parent 15814dba5b
commit bb3d25b626
2 changed files with 2 additions and 2 deletions
include/spdlog
src

View File

@ -209,7 +209,7 @@ protected:
} }
} }
virtual void flush_(); virtual void flush_();
bool should_flush_(const details::log_msg &msg); [[nodiscard]] bool should_flush_(const details::log_msg &msg) const;
// handle errors during logging. // handle errors during logging.
// default handler prints the error to stderr at max rate of 1 message/sec. // default handler prints the error to stderr at max rate of 1 message/sec.

View File

@ -81,7 +81,7 @@ void logger::flush_() {
} }
} }
bool logger::should_flush_(const details::log_msg &msg) { bool logger::should_flush_(const details::log_msg &msg) const {
auto flush_level = flush_level_.load(std::memory_order_relaxed); auto flush_level = flush_level_.load(std::memory_order_relaxed);
return (msg.log_level >= flush_level) && (msg.log_level != level::off); return (msg.log_level >= flush_level) && (msg.log_level != level::off);
} }