20 inline spdlog::async_logger::async_logger(
const std::string& logger_name,
25 const std::function<
void()>& worker_warmup_cb,
26 const std::chrono::milliseconds& flush_interval_ms,
27 const std::function<
void()>& worker_teardown_cb) :
28 logger(logger_name, begin, end),
29 _async_log_helper(new details::async_log_helper(_formatter, _sinks, queue_size, _err_handler, overflow_policy, worker_warmup_cb, flush_interval_ms, worker_teardown_cb))
33 inline spdlog::async_logger::async_logger(
const std::string& logger_name,
37 const std::function<
void()>& worker_warmup_cb,
38 const std::chrono::milliseconds& flush_interval_ms,
39 const std::function<
void()>& worker_teardown_cb) :
40 async_logger(logger_name, sinks_list.begin(), sinks_list.end(), queue_size, overflow_policy, worker_warmup_cb, flush_interval_ms, worker_teardown_cb) {}
42 inline spdlog::async_logger::async_logger(
const std::string& logger_name,
46 const std::function<
void()>& worker_warmup_cb,
47 const std::chrono::milliseconds& flush_interval_ms,
48 const std::function<
void()>& worker_teardown_cb) :
52 }, queue_size, overflow_policy, worker_warmup_cb, flush_interval_ms, worker_teardown_cb) {}
81 _formatter = std::make_shared<pattern_formatter>(pattern, pattern_time);
86 inline void spdlog::async_logger::_sink_it(details::log_msg& msg)
90 #if defined(SPDLOG_ENABLE_MESSAGE_COUNTER) 91 msg.msg_id =
_msg_counter.fetch_add(1, std::memory_order_relaxed);
97 catch (
const std::exception &ex)
std::unique_ptr< details::async_log_helper > _async_log_helper
std::shared_ptr< spdlog::formatter > formatter_ptr
std::shared_ptr< sinks::sink > sink_ptr
async_logger(const std::string &name, const It &begin, const It &end, size_t queue_size, const async_overflow_policy overflow_policy=async_overflow_policy::block_retry, const std::function< void()> &worker_warmup_cb=nullptr, const std::chrono::milliseconds &flush_interval_ms=std::chrono::milliseconds::zero(), const std::function< void()> &worker_teardown_cb=nullptr)
OStream< ChannelType > & flush(OStream< ChannelType > &os)
void set_error_handler(log_err_handler)
std::atomic< size_t > _msg_counter
std::initializer_list< sink_ptr > sinks_init_list
bool _should_flush_on(const details::log_msg &)
std::function< void(const std::string &err_msg)> log_err_handler
log_err_handler _err_handler