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

Classes

class  async_worker
 Standalone async worker with jthread compatibility. More...
 
class  batch_processing_jthread_worker
 Worker thread for batch processing with jthread compatibility. More...
 
class  batch_processor
 Advanced batch processor with dynamic sizing and back-pressure handling. More...
 
class  compat_cv_wait
 Condition variable wait helper with stop support. More...
 
class  compat_jthread
 Wrapper for std::jthread or std::thread with manual stop mechanism. More...
 
class  high_performance_async_writer
 High-performance asynchronous writer. More...
 
class  lockfree_mpmc_queue
 Multi-producer multi-consumer lock-free queue (for future use) More...
 
class  lockfree_spsc_queue
 Lock-free single-producer single-consumer queue. More...
 
class  simple_stop_source
 Simple stop source for environments without std::stop_token. More...
 

Typedefs

using task_type = std::function<void()>
 Task type for async worker.
 

Functions

std::unique_ptr< batch_processormake_batch_processor (log_writer_ptr writer, const batch_processor::config &cfg=batch_processor::config{})
 Factory function to create a batch processor.
 
std::unique_ptr< high_performance_async_writermake_high_performance_async_writer (log_writer_ptr writer, const high_performance_async_writer::config &cfg=high_performance_async_writer::config{})
 Factory function to create a high-performance async writer.
 
template<typename T , size_t Size = 1024>
std::unique_ptr< lockfree_spsc_queue< T, Size > > make_lockfree_queue ()
 Factory function to create a lock-free queue.
 

Typedef Documentation

◆ task_type

using kcenon::logger::async::task_type = std::function<void()>

Task type for async worker.

A task is a callable that performs a logging operation. Using std::function allows flexible task composition.

Definition at line 47 of file async_worker.h.

Function Documentation

◆ make_batch_processor()

std::unique_ptr< batch_processor > kcenon::logger::async::make_batch_processor ( log_writer_ptr writer,
const batch_processor::config & cfg = batch_processor::config{} )

Factory function to create a batch processor.

Parameters
writerTarget writer
cfgConfiguration
Returns
Unique pointer to batch processor

Definition at line 414 of file batch_processor.cpp.

416 {
417 return std::make_unique<batch_processor>(std::move(writer), cfg);
418}

◆ make_high_performance_async_writer()

std::unique_ptr< high_performance_async_writer > kcenon::logger::async::make_high_performance_async_writer ( log_writer_ptr writer,
const high_performance_async_writer::config & cfg = high_performance_async_writer::config{} )

Factory function to create a high-performance async writer.

Parameters
writerWriter to wrap
cfgConfiguration
Returns
Unique pointer to the writer

Definition at line 200 of file high_performance_async_writer.cpp.

202 {
203 return std::make_unique<high_performance_async_writer>(std::move(writer), cfg);
204}

◆ make_lockfree_queue()

template<typename T , size_t Size = 1024>
std::unique_ptr< lockfree_spsc_queue< T, Size > > kcenon::logger::async::make_lockfree_queue ( )

Factory function to create a lock-free queue.

Template Parameters
TElement type
SizeQueue size (must be power of 2)
Returns
Unique pointer to the queue

Definition at line 197 of file lockfree_queue.h.

197 {
198 return std::make_unique<lockfree_spsc_queue<T, Size>>();
199}