mirror of
https://github.com/gabime/spdlog.git
synced 2025-01-24 06:32:06 +08:00
Allow custom formatter in sink ctor
This commit is contained in:
parent
c5552dac1f
commit
79f11bd655
@ -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:
|
|||||||
|
|
||||||
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
|
||||||
|
Loading…
Reference in New Issue
Block a user