Commit dc166cad authored by gabime's avatar gabime

Added default pattern support for pattern_formatter to avoid parsing pattern...

Added default pattern support for pattern_formatter to avoid parsing pattern when using default pattern
parent 7d7ccac4
...@@ -869,6 +869,18 @@ public: ...@@ -869,6 +869,18 @@ public:
compile_pattern_(pattern_); 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::full_formatter>(details::padding_info()));
}
pattern_formatter(const pattern_formatter &other) = delete; pattern_formatter(const pattern_formatter &other) = delete;
pattern_formatter &operator=(const pattern_formatter &other) = delete; pattern_formatter &operator=(const pattern_formatter &other) = delete;
......
...@@ -231,7 +231,7 @@ public: ...@@ -231,7 +231,7 @@ public:
private: private:
registry() registry()
: formatter_(new pattern_formatter("%+")) : formatter_(new pattern_formatter())
{ {
#ifndef SPDLOG_DISABLE_DEFAULT_LOGGER #ifndef SPDLOG_DISABLE_DEFAULT_LOGGER
......
...@@ -16,7 +16,7 @@ class sink ...@@ -16,7 +16,7 @@ class sink
public: public:
sink() sink()
: level_(level::trace) : level_(level::trace)
, formatter_(new pattern_formatter("%+")) , formatter_(new pattern_formatter())
{ {
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment