mirror of
https://github.com/gabime/spdlog.git
synced 2025-01-12 17:00:25 +08:00
Added default pattern support for pattern_formatter to avoid parsing pattern when using default pattern
This commit is contained in:
parent
7d7ccac416
commit
dc166cad92
@ -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::full_formatter>(details::padding_info()));
|
||||
}
|
||||
|
||||
pattern_formatter(const pattern_formatter &other) = delete;
|
||||
pattern_formatter &operator=(const pattern_formatter &other) = delete;
|
||||
|
||||
|
@ -231,7 +231,7 @@ public:
|
||||
|
||||
private:
|
||||
registry()
|
||||
: formatter_(new pattern_formatter("%+"))
|
||||
: formatter_(new pattern_formatter())
|
||||
{
|
||||
|
||||
#ifndef SPDLOG_DISABLE_DEFAULT_LOGGER
|
||||
|
@ -16,7 +16,7 @@ class sink
|
||||
public:
|
||||
sink()
|
||||
: level_(level::trace)
|
||||
, formatter_(new pattern_formatter("%+"))
|
||||
, formatter_(new pattern_formatter())
|
||||
{
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user