diff --git a/include/spdlog/details/pattern_formatter.h b/include/spdlog/details/pattern_formatter.h index b76bd485..38c28dfc 100644 --- a/include/spdlog/details/pattern_formatter.h +++ b/include/spdlog/details/pattern_formatter.h @@ -869,6 +869,18 @@ public: compile_pattern_(pattern_); } + // use by default full formatter for if pattern is not given + explicit pattern_formatter( + pattern_time_type time_type = pattern_time_type::local, std::string eol = spdlog::details::os::default_eol) + : pattern_() + , eol_(std::move(eol)) + , pattern_time_type_(time_type) + , last_log_secs_(0) + { + std::memset(&cached_tm_, 0, sizeof(cached_tm_)); + formatters_.push_back(details::make_unique(details::padding_info())); + } + pattern_formatter(const pattern_formatter &other) = delete; pattern_formatter &operator=(const pattern_formatter &other) = delete; diff --git a/include/spdlog/details/registry.h b/include/spdlog/details/registry.h index 439395f7..1f15b05e 100644 --- a/include/spdlog/details/registry.h +++ b/include/spdlog/details/registry.h @@ -231,7 +231,7 @@ public: private: registry() - : formatter_(new pattern_formatter("%+")) + : formatter_(new pattern_formatter()) { #ifndef SPDLOG_DISABLE_DEFAULT_LOGGER diff --git a/include/spdlog/sinks/sink.h b/include/spdlog/sinks/sink.h index 9f84c378..2f1adc10 100644 --- a/include/spdlog/sinks/sink.h +++ b/include/spdlog/sinks/sink.h @@ -16,7 +16,7 @@ class sink public: sink() : level_(level::trace) - , formatter_(new pattern_formatter("%+")) + , formatter_(new pattern_formatter()) { }