diff --git a/include/spdlog/details/pattern_formatter.h b/include/spdlog/details/pattern_formatter.h index d372a337..2bf8ea3e 100644 --- a/include/spdlog/details/pattern_formatter.h +++ b/include/spdlog/details/pattern_formatter.h @@ -29,6 +29,16 @@ class flag_formatter public: virtual ~flag_formatter() = default; virtual void format(const details::log_msg &msg, const std::tm &tm_time, fmt::memory_buffer &dest) = 0; + +protected: + fmt::memory_buffer cached_buf_; + std::tm cached_tm_; + bool from_cache(const std::tm &tm_time, fmt::memory_buffer &dest) + { + + } + + }; /////////////////////////////////////////////////////////////////////// @@ -460,7 +470,7 @@ class full_formatter SPDLOG_FINAL : public flag_formatter // each second cache the header auto duration = msg.time.time_since_epoch(); auto seconds = std::chrono::duration_cast(duration).count(); - if (true || cached_header_.size() == 0 || cached_seconds_ts_ != seconds) + if (cached_header_.size() == 0 || cached_seconds_ts_ != seconds) { cached_header_.resize(0); cached_header_.push_back('[');