mirror of
https://github.com/gabime/spdlog.git
synced 2025-09-30 10:29:02 +08:00
Refactored logger
This commit is contained in:
@@ -172,6 +172,18 @@ SPDLOG_INLINE std::shared_ptr<logger> logger::clone(std::string logger_name)
|
||||
}
|
||||
|
||||
// protected methods
|
||||
SPDLOG_INLINE void logger::log_it_(const details::log_msg &log_msg)
|
||||
{
|
||||
if (should_log(log_msg.level))
|
||||
{
|
||||
sink_it_(log_msg);
|
||||
}
|
||||
if (tracer_.enabled())
|
||||
{
|
||||
tracer_.push_back(log_msg);
|
||||
}
|
||||
}
|
||||
|
||||
SPDLOG_INLINE void logger::sink_it_(const details::log_msg &msg)
|
||||
{
|
||||
for (auto &sink : sinks_)
|
||||
@@ -207,7 +219,7 @@ SPDLOG_INLINE void logger::flush_()
|
||||
SPDLOG_INLINE void logger::dump_backtrace_()
|
||||
{
|
||||
using details::log_msg;
|
||||
if (tracer_)
|
||||
if (tracer_.enabled())
|
||||
{
|
||||
sink_it_(log_msg{name(), level::info, "****************** Backtrace Start ******************"});
|
||||
tracer_.foreach_pop([this](const log_msg &msg) { this->sink_it_(msg); });
|
||||
|
Reference in New Issue
Block a user