Allow overriding need_localtime for custom formatter

This commit is contained in:
Jeeyong Um
2022-05-07 20:39:10 +08:00
parent a9347017db
commit 38929f856d
3 changed files with 40 additions and 1 deletions

View File

@@ -1081,6 +1081,11 @@ SPDLOG_INLINE void pattern_formatter::set_pattern(std::string pattern)
compile_pattern_(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)
{
if (pattern_time_type_ == pattern_time_type::local)

View File

@@ -98,6 +98,7 @@ public:
return *this;
}
void set_pattern(std::string pattern);
void need_localtime(bool need = true);
private:
std::string pattern_;