From 79f11bd655fdf501839ab8f12020b40263199cdc Mon Sep 17 00:00:00 2001 From: DanielChabrowski Date: Sun, 3 Feb 2019 16:12:00 +0100 Subject: [PATCH] Allow custom formatter in sink ctor --- include/spdlog/sinks/sink.h | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/include/spdlog/sinks/sink.h b/include/spdlog/sinks/sink.h index 2f1adc10b..d83252333 100644 --- a/include/spdlog/sinks/sink.h +++ b/include/spdlog/sinks/sink.h @@ -14,15 +14,10 @@ namespace sinks { class sink { public: - sink() - : level_(level::trace) - , formatter_(new pattern_formatter()) - { - } + sink() = default; - explicit sink(std::unique_ptr formatter) - : level_(level::trace) - , formatter_(std::move(formatter)) + explicit sink(std::unique_ptr formatter) + : formatter_{std::move(formatter)} { } @@ -49,10 +44,10 @@ class sink protected: // sink log level - default is all - level_t level_; + level_t level_{level::trace}; // sink formatter - default is full format - std::unique_ptr formatter_; + std::unique_ptr formatter_{details::make_unique()}; }; } // namespace sinks