Skip to content

Commit

Permalink
Merge pull request #986 from DanielChabrowski/sink-allow-custom-forma…
Browse files Browse the repository at this point in the history
…tter

Allow custom formatter in sink's ctor
  • Loading branch information
gabime authored Feb 3, 2019
2 parents c5552da + 79f11bd commit c443896
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions include/spdlog/sinks/sink.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,10 @@ namespace sinks {
class sink
{
public:
sink()
: level_(level::trace)
, formatter_(new pattern_formatter())
{
}
sink() = default;

explicit sink(std::unique_ptr<spdlog::pattern_formatter> formatter)
: level_(level::trace)
, formatter_(std::move(formatter))
explicit sink(std::unique_ptr<spdlog::formatter> formatter)
: formatter_{std::move(formatter)}
{
}

Expand All @@ -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<spdlog::formatter> formatter_;
std::unique_ptr<spdlog::formatter> formatter_{details::make_unique<spdlog::pattern_formatter>()};
};

} // namespace sinks
Expand Down

0 comments on commit c443896

Please sign in to comment.