Renamed file to pattern_forammter.h and fixed utc support

This commit is contained in:
gabime
2018-07-07 16:15:17 +03:00
parent cbc4db8649
commit c9331594bb
7 changed files with 17 additions and 14 deletions

View File

@@ -525,10 +525,10 @@ private:
class pattern_formatter SPDLOG_FINAL : public formatter
{
public:
explicit pattern_formatter(const std::string &pattern, pattern_time_type pattern_time = pattern_time_type::local,
explicit pattern_formatter(const std::string &pattern, pattern_time_type time_type = pattern_time_type::local,
std::string eol = spdlog::details::os::default_eol)
: eol_(std::move(eol))
, pattern_time_(pattern_time)
, pattern_time_type_(time_type)
, last_log_secs_(0)
{
std::memset(&cached_tm_, 0, sizeof(cached_tm_));
@@ -557,14 +557,15 @@ public:
private:
const std::string eol_;
const pattern_time_type pattern_time_;
pattern_time_type pattern_time_type_;
std::tm cached_tm_;
std::chrono::seconds last_log_secs_;
std::vector<std::unique_ptr<details::flag_formatter>> formatters_;
std::tm get_time_(const details::log_msg &msg)
{
if (pattern_time_ == pattern_time_type::local)
if (pattern_time_type_ == pattern_time_type::local)
{
return details::os::localtime(log_clock::to_time_t(msg.time));
}