Ark Server API (ASE) - Wiki
Loading...
Searching...
No Matches
spdlog::details::async_log_helper Class Reference

#include <async_log_helper.h>

+ Collaboration diagram for spdlog::details::async_log_helper:

Classes

struct  async_msg
 

Public Types

using item_type = async_msg
 
using q_type = details::mpmc_bounded_queue<item_type>
 
using clock = std::chrono::steady_clock
 

Public Member Functions

 async_log_helper (formatter_ptr formatter, const std::vector< sink_ptr > &sinks, size_t queue_size, const log_err_handler err_handler, 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)
 
void log (const details::log_msg &msg)
 
 ~async_log_helper ()
 
void set_formatter (formatter_ptr)
 
void flush (bool wait_for_q)
 
void set_error_handler (spdlog::log_err_handler err_handler)
 

Private Types

enum class  async_msg_type { log , flush , terminate }
 

Private Member Functions

void push_msg (async_msg &&new_msg)
 
void worker_loop ()
 
bool process_next_msg (log_clock::time_point &last_pop, log_clock::time_point &last_flush)
 
void handle_flush_interval (log_clock::time_point &now, log_clock::time_point &last_flush)
 
void wait_empty_q ()
 

Static Private Member Functions

static void sleep_or_yield (const spdlog::log_clock::time_point &now, const log_clock::time_point &last_op_time)
 

Private Attributes

formatter_ptr _formatter
 
std::vector< std::shared_ptr< sinks::sink > > _sinks
 
q_type _q
 
log_err_handler _err_handler
 
bool _flush_requested
 
bool _terminate_requested
 
const async_overflow_policy _overflow_policy
 
const std::function< void()> _worker_warmup_cb
 
const std::chrono::milliseconds _flush_interval_ms
 
const std::function< void()> _worker_teardown_cb
 
std::thread _worker_thread
 

Detailed Description

Definition at line 36 of file async_log_helper.h.

Member Typedef Documentation

◆ clock

using spdlog::details::async_log_helper::clock = std::chrono::steady_clock

Definition at line 125 of file async_log_helper.h.

◆ item_type

◆ q_type

Member Enumeration Documentation

◆ async_msg_type

Enumerator
log 
flush 
terminate 

Definition at line 40 of file async_log_helper.h.

Constructor & Destructor Documentation

◆ async_log_helper()

spdlog::details::async_log_helper::async_log_helper ( formatter_ptr formatter,
const std::vector< sink_ptr > & sinks,
size_t queue_size,
const log_err_handler err_handler,
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 )
inline

Definition at line 201 of file async_log_helper.h.

+ Here is the call graph for this function:

◆ ~async_log_helper()

spdlog::details::async_log_helper::~async_log_helper ( )
inline

Definition at line 225 of file async_log_helper.h.

+ Here is the call graph for this function:

Member Function Documentation

◆ flush()

void spdlog::details::async_log_helper::flush ( bool wait_for_q)
inline

Definition at line 260 of file async_log_helper.h.

+ Here is the call graph for this function:

◆ handle_flush_interval()

void spdlog::details::async_log_helper::handle_flush_interval ( log_clock::time_point & now,
log_clock::time_point & last_flush )
inlineprivate

Definition at line 340 of file async_log_helper.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ log()

void spdlog::details::async_log_helper::log ( const details::log_msg & msg)
inline

Definition at line 239 of file async_log_helper.h.

+ Here is the call graph for this function:

◆ process_next_msg()

bool spdlog::details::async_log_helper::process_next_msg ( log_clock::time_point & last_pop,
log_clock::time_point & last_flush )
inlineprivate

Definition at line 295 of file async_log_helper.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ push_msg()

void spdlog::details::async_log_helper::push_msg ( async_msg && new_msg)
inlineprivate

Definition at line 244 of file async_log_helper.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set_error_handler()

void spdlog::details::async_log_helper::set_error_handler ( spdlog::log_err_handler err_handler)
inline

Definition at line 393 of file async_log_helper.h.

◆ set_formatter()

void spdlog::details::async_log_helper::set_formatter ( formatter_ptr msg_formatter)
inline

Definition at line 352 of file async_log_helper.h.

◆ sleep_or_yield()

void spdlog::details::async_log_helper::sleep_or_yield ( const spdlog::log_clock::time_point & now,
const log_clock::time_point & last_op_time )
inlinestaticprivate

Definition at line 359 of file async_log_helper.h.

+ Here is the caller graph for this function:

◆ wait_empty_q()

void spdlog::details::async_log_helper::wait_empty_q ( )
inlineprivate

Definition at line 384 of file async_log_helper.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ worker_loop()

void spdlog::details::async_log_helper::worker_loop ( )
inlineprivate

Definition at line 267 of file async_log_helper.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ _err_handler

log_err_handler spdlog::details::async_log_helper::_err_handler
private

Definition at line 155 of file async_log_helper.h.

◆ _flush_interval_ms

const std::chrono::milliseconds spdlog::details::async_log_helper::_flush_interval_ms
private

Definition at line 169 of file async_log_helper.h.

◆ _flush_requested

bool spdlog::details::async_log_helper::_flush_requested
private

Definition at line 157 of file async_log_helper.h.

◆ _formatter

formatter_ptr spdlog::details::async_log_helper::_formatter
private

Definition at line 149 of file async_log_helper.h.

◆ _overflow_policy

const async_overflow_policy spdlog::details::async_log_helper::_overflow_policy
private

Definition at line 163 of file async_log_helper.h.

◆ _q

q_type spdlog::details::async_log_helper::_q
private

Definition at line 153 of file async_log_helper.h.

◆ _sinks

std::vector<std::shared_ptr<sinks::sink> > spdlog::details::async_log_helper::_sinks
private

Definition at line 150 of file async_log_helper.h.

◆ _terminate_requested

bool spdlog::details::async_log_helper::_terminate_requested
private

Definition at line 159 of file async_log_helper.h.

◆ _worker_teardown_cb

const std::function<void()> spdlog::details::async_log_helper::_worker_teardown_cb
private

Definition at line 172 of file async_log_helper.h.

◆ _worker_thread

std::thread spdlog::details::async_log_helper::_worker_thread
private

Definition at line 175 of file async_log_helper.h.

◆ _worker_warmup_cb

const std::function<void()> spdlog::details::async_log_helper::_worker_warmup_cb
private

Definition at line 166 of file async_log_helper.h.


The documentation for this class was generated from the following file: