Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gabime/spdlog.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeeyong Um <conr2d@gmail.com>2022-05-07 15:39:10 +0300
committerJeeyong Um <conr2d@gmail.com>2022-05-07 15:44:00 +0300
commit38929f856db663ec2abb938bb5cb88b24ed2c9b8 (patch)
tree31c6d4eb8ffca4cfc122464a63155d0799a61f11 /include/spdlog
parenta9347017db7bba66a070a92235eafc618d0ef087 (diff)
Allow overriding need_localtime for custom formatter
Diffstat (limited to 'include/spdlog')
-rw-r--r--include/spdlog/pattern_formatter-inl.h5
-rw-r--r--include/spdlog/pattern_formatter.h1
2 files changed, 6 insertions, 0 deletions
diff --git a/include/spdlog/pattern_formatter-inl.h b/include/spdlog/pattern_formatter-inl.h
index bf9da079..0d36fc85 100644
--- a/include/spdlog/pattern_formatter-inl.h
+++ b/include/spdlog/pattern_formatter-inl.h
@@ -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)
diff --git a/include/spdlog/pattern_formatter.h b/include/spdlog/pattern_formatter.h
index 8bcf8e2a..acf1c536 100644
--- a/include/spdlog/pattern_formatter.h
+++ b/include/spdlog/pattern_formatter.h
@@ -98,6 +98,7 @@ public:
return *this;
}
void set_pattern(std::string pattern);
+ void need_localtime(bool need = true);
private:
std::string pattern_;