diff --git a/include/spdlog/logger-inl.h b/include/spdlog/logger-inl.h index 5218fe4c..6879273c 100644 --- a/include/spdlog/logger-inl.h +++ b/include/spdlog/logger-inl.h @@ -57,7 +57,7 @@ SPDLOG_INLINE void logger::swap(spdlog::logger &other) SPDLOG_NOEXCEPT { std::swap(tracer_, other.tracer_); } -SPDLOG_INLINE void swap(logger &a, logger &b) { a.swap(b); } +SPDLOG_INLINE void swap(logger &a, logger &b) noexcept { a.swap(b); } SPDLOG_INLINE void logger::set_level(level::level_enum log_level) { level_.store(log_level); } @@ -163,12 +163,12 @@ SPDLOG_INLINE void logger::dump_backtrace_() { } } -SPDLOG_INLINE bool logger::should_flush_(const details::log_msg &msg) { +SPDLOG_INLINE bool logger::should_flush_(const details::log_msg &msg) const { auto flush_level = flush_level_.load(std::memory_order_relaxed); return (msg.level >= flush_level) && (msg.level != level::off); } -SPDLOG_INLINE void logger::err_handler_(const std::string &msg) { +SPDLOG_INLINE void logger::err_handler_(const std::string &msg) const { if (custom_err_handler_) { custom_err_handler_(msg); } else { diff --git a/include/spdlog/logger.h b/include/spdlog/logger.h index f49bdc00..8c3cd91f 100644 --- a/include/spdlog/logger.h +++ b/include/spdlog/logger.h @@ -363,14 +363,14 @@ protected: virtual void sink_it_(const details::log_msg &msg); virtual void flush_(); void dump_backtrace_(); - bool should_flush_(const details::log_msg &msg); + bool should_flush_(const details::log_msg &msg) const; // handle errors during logging. // default handler prints the error to stderr at max rate of 1 message/sec. - void err_handler_(const std::string &msg); + void err_handler_(const std::string &msg) const; }; -void swap(logger &a, logger &b); +void swap(logger &a, logger &b) noexcept; } // namespace spdlog