Classes | Public Types | Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
spdlog::details::async_log_helper Class Reference

#include <async_log_helper.h>

Classes

struct  async_msg
 

Public Types

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

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 flush (bool wait_for_q)
 
void log (const details::log_msg &msg)
 
void set_error_handler (spdlog::log_err_handler err_handler)
 
void set_formatter (formatter_ptr)
 
 ~async_log_helper ()
 

Private Types

enum  async_msg_type { async_msg_type::log, async_msg_type::flush, async_msg_type::terminate }
 

Private Member Functions

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

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

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

Detailed Description

Definition at line 36 of file async_log_helper.h.

Member Typedef Documentation

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

Definition at line 125 of file async_log_helper.h.

Definition at line 122 of file async_log_helper.h.

Definition at line 123 of file async_log_helper.h.

Member Enumeration Documentation

Enumerator
log 
flush 
terminate 

Definition at line 40 of file async_log_helper.h.

Constructor & Destructor Documentation

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.

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

Definition at line 225 of file async_log_helper.h.

Member Function Documentation

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

Definition at line 260 of file async_log_helper.h.

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.

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

Definition at line 239 of file async_log_helper.h.

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.

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

Definition at line 244 of file async_log_helper.h.

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.

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

Definition at line 352 of file async_log_helper.h.

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.

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

Definition at line 384 of file async_log_helper.h.

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

Definition at line 267 of file async_log_helper.h.

Member Data Documentation

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

Definition at line 155 of file async_log_helper.h.

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

Definition at line 169 of file async_log_helper.h.

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

Definition at line 157 of file async_log_helper.h.

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

Definition at line 149 of file async_log_helper.h.

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

Definition at line 163 of file async_log_helper.h.

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

Definition at line 153 of file async_log_helper.h.

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

Definition at line 150 of file async_log_helper.h.

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

Definition at line 159 of file async_log_helper.h.

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

Definition at line 172 of file async_log_helper.h.

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

Definition at line 175 of file async_log_helper.h.

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:


ros_opcua_impl_freeopcua
Author(s): Denis Štogl
autogenerated on Tue Jan 19 2021 03:12:10