mirror of
https://github.com/gabime/spdlog.git
synced 2026-01-19 04:52:09 +00:00
Add const qualifier to get_time_ and filter_ member functions (#3515)
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ private:
|
||||
std::vector<std::unique_ptr<details::flag_formatter>> 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 <typename Padder>
|
||||
void handle_flag_(char flag, details::padding_info padding);
|
||||
|
||||
|
||||
@@ -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_);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user