Logger System 0.1.3
High-performance C++20 thread-safe logging system with asynchronous capabilities
Loading...
Searching...
No Matches
kcenon::logger::log_collector_shared_state Struct Reference

Shared state for log processing - survives impl destruction. More...

Collaboration diagram for kcenon::logger::log_collector_shared_state:
Collaboration graph

Public Member Functions

 log_collector_shared_state (std::size_t buffer_sz, std::size_t batch_sz)
 

Public Attributes

std::queue< log_entryqueue
 
std::mutex queue_mutex
 
std::condition_variable queue_cv
 
std::vector< std::weak_ptr< log_writer_interface > > writers
 
std::mutex writers_mutex
 
const std::size_t batch_size
 
const std::size_t buffer_size
 

Detailed Description

Shared state for log processing - survives impl destruction.

This structure holds all the data that the worker needs to access. By using shared_ptr, the worker can safely access this data even after the impl object starts destruction, preventing use-after-free bugs.

Definition at line 45 of file log_collector.cpp.

Constructor & Destructor Documentation

◆ log_collector_shared_state()

kcenon::logger::log_collector_shared_state::log_collector_shared_state ( std::size_t buffer_sz,
std::size_t batch_sz )
inlineexplicit

Definition at line 58 of file log_collector.cpp.

59 : batch_size(batch_sz)
60 , buffer_size(buffer_sz) {}

Member Data Documentation

◆ batch_size

const std::size_t kcenon::logger::log_collector_shared_state::batch_size

Definition at line 55 of file log_collector.cpp.

◆ buffer_size

const std::size_t kcenon::logger::log_collector_shared_state::buffer_size

Definition at line 56 of file log_collector.cpp.

◆ queue

std::queue<log_entry> kcenon::logger::log_collector_shared_state::queue

Definition at line 46 of file log_collector.cpp.

◆ queue_cv

std::condition_variable kcenon::logger::log_collector_shared_state::queue_cv

Definition at line 51 of file log_collector.cpp.

◆ queue_mutex

std::mutex kcenon::logger::log_collector_shared_state::queue_mutex
mutable

Definition at line 47 of file log_collector.cpp.

◆ writers

std::vector<std::weak_ptr<log_writer_interface> > kcenon::logger::log_collector_shared_state::writers

Definition at line 53 of file log_collector.cpp.

◆ writers_mutex

std::mutex kcenon::logger::log_collector_shared_state::writers_mutex

Definition at line 54 of file log_collector.cpp.


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