36 template<async_overflow_policy OverflowPolicy = async_overflow_policy::block>
39 template<
typename Sink,
typename... SinkArgs>
45 std::lock_guard<std::recursive_mutex> tp_lock(registry_inst.tp_mutex());
46 auto tp = registry_inst.get_tp();
50 registry_inst.set_tp(tp);
53 auto sink = std::make_shared<Sink>(std::forward<SinkArgs>(
args)...);
55 registry_inst.initialize_logger(new_logger);
63 template<
typename Sink,
typename... SinkArgs>
66 return async_factory::create<Sink>(
std::move(logger_name), std::forward<SinkArgs>(sink_args)...);
69 template<
typename Sink,
typename... SinkArgs>
72 return async_factory_nonblock::create<Sink>(
std::move(logger_name), std::forward<SinkArgs>(sink_args)...);
78 auto tp = std::make_shared<details::thread_pool>(q_size, thread_count);
83 inline std::shared_ptr<spdlog::details::thread_pool>
thread_pool()
std::shared_ptr< thread_pool > get_tp()
void init_thread_pool(size_t q_size, size_t thread_count)
static std::shared_ptr< async_logger > create(std::string logger_name, SinkArgs &&...args)
static registry & instance()
void set_tp(std::shared_ptr< thread_pool > tp)
std::shared_ptr< spdlog::details::thread_pool > thread_pool()
static const size_t default_async_q_size
std::shared_ptr< spdlog::logger > create_async(std::string logger_name, SinkArgs &&...sink_args)
std::shared_ptr< spdlog::logger > create_async_nb(std::string logger_name, SinkArgs &&...sink_args)