diff --git a/include/spdlog/pattern_formatter-inl.h b/include/spdlog/pattern_formatter-inl.h index 25aa505b..f6506279 100644 --- a/include/spdlog/pattern_formatter-inl.h +++ b/include/spdlog/pattern_formatter-inl.h @@ -1011,7 +1011,7 @@ SPDLOG_INLINE void pattern_formatter::set_pattern(std::string pattern) { SPDLOG_INLINE void pattern_formatter::need_localtime(bool need) { need_localtime_ = need; } -SPDLOG_INLINE std::tm pattern_formatter::get_time_(const details::log_msg &msg) { +SPDLOG_INLINE std::tm pattern_formatter::get_time_(const details::log_msg &msg) const { if (pattern_time_type_ == pattern_time_type::local) { return details::os::localtime(log_clock::to_time_t(msg.time)); } diff --git a/include/spdlog/pattern_formatter.h b/include/spdlog/pattern_formatter.h index 0658161c..42a7509e 100644 --- a/include/spdlog/pattern_formatter.h +++ b/include/spdlog/pattern_formatter.h @@ -99,7 +99,7 @@ private: std::vector> formatters_; custom_flags custom_handlers_; - std::tm get_time_(const details::log_msg &msg); + std::tm get_time_(const details::log_msg &msg) const; template void handle_flag_(char flag, details::padding_info padding); diff --git a/include/spdlog/sinks/dup_filter_sink.h b/include/spdlog/sinks/dup_filter_sink.h index 0588d772..1071e98b 100644 --- a/include/spdlog/sinks/dup_filter_sink.h +++ b/include/spdlog/sinks/dup_filter_sink.h @@ -78,8 +78,8 @@ protected: } // return whether the log msg should be displayed (true) or skipped (false) - bool filter_(const details::log_msg &msg) { - auto filter_duration = msg.time - last_msg_time_; + bool filter_(const details::log_msg &msg) const { + const auto filter_duration = msg.time - last_msg_time_; return (filter_duration > max_skip_duration_) || (msg.payload != last_msg_payload_); } };