Unverified Commit c4438966 authored by Gabi Melman's avatar Gabi Melman Committed by GitHub

Merge pull request #986 from DanielChabrowski/sink-allow-custom-formatter

Allow custom formatter in sink's ctor
parents c5552dac 79f11bd6
...@@ -14,15 +14,10 @@ namespace sinks { ...@@ -14,15 +14,10 @@ namespace sinks {
class sink class sink
{ {
public: public:
sink() sink() = default;
: level_(level::trace)
, formatter_(new pattern_formatter())
{
}
explicit sink(std::unique_ptr<spdlog::pattern_formatter> formatter) explicit sink(std::unique_ptr<spdlog::formatter> formatter)
: level_(level::trace) : formatter_{std::move(formatter)}
, formatter_(std::move(formatter))
{ {
} }
...@@ -49,10 +44,10 @@ public: ...@@ -49,10 +44,10 @@ public:
protected: protected:
// sink log level - default is all // sink log level - default is all
level_t level_; level_t level_{level::trace};
// sink formatter - default is full format // sink formatter - default is full format
std::unique_ptr<spdlog::formatter> formatter_; std::unique_ptr<spdlog::formatter> formatter_{details::make_unique<spdlog::pattern_formatter>()};
}; };
} // namespace sinks } // namespace sinks
......
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