21 , thread_pool_(
std::move(tp))
22 , overflow_policy_(overflow_policy)
34 :
async_logger(
std::move(logger_name), {std::move(single_sink)}, std::move(tp), overflow_policy)
41 #if defined(SPDLOG_ENABLE_MESSAGE_COUNTER)
42 incr_msg_counter_(msg);
44 if (
auto pool_ptr = thread_pool_.lock())
46 pool_ptr->post_log(shared_from_this(), msg, overflow_policy_);
50 throw spdlog_ex(
"async log: thread pool doesn't exist anymore");
57 if (
auto pool_ptr = thread_pool_.lock())
59 pool_ptr->post_flush(shared_from_this(), overflow_policy_);
63 throw spdlog_ex(
"async flush: thread pool doesn't exist anymore");
74 for (
auto &s : sinks_)
76 if (s->should_log(incoming_log_msg.
level))
78 s->log(incoming_log_msg);
84 if (should_flush_(incoming_log_msg))
94 for (
auto &sink : sinks_)
104 auto cloned = std::make_shared<spdlog::async_logger>(std::move(new_name), sinks_.begin(), sinks_.end(), thread_pool_, overflow_policy_);
106 cloned->set_level(this->level());
107 cloned->flush_on(this->flush_level());
108 cloned->set_error_handler(this->error_handler());
109 return std::move(cloned);