CppTrail
Loading...
Searching...
No Matches
async_logger.h File Reference

Asynchronous logger implementation using a background worker pool. More...

#include <atomic>
#include <condition_variable>
#include <mutex>
#include <queue>
#include <stdexcept>
#include <thread>
#include <vector>
#include "cpptrail/base_logger.h"
Include dependency graph for async_logger.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  CppTrail::LoggerOverflowError
 Exception thrown when the logger queue exceeds its maximum allowed size. This exception is specifically utilized by AsyncLoggerImpl when m_bThrowOnOverflow is set to true and the incoming log rate exceeds the processing capacity of the worker threads. More...
 
class  CppTrail::BasicAsyncLoggerImpl< char_t >
 An asynchronous logger template utilizing background worker threads and object recycling. This class decouples the logging call from the actual I/O operation. It maintains an internal queue of log entries and a pool of worker threads to process them. To minimize heap pressure, it uses a backup pool (object pool) to recycle linked-list nodes. More...
 

Namespaces

namespace  CppTrail
 Root namespace for the CppTrail logging library.
 

Typedefs

Logger Type Aliases

Standardized aliases for common character encodings.

using CppTrail::AsyncLoggerImpl = BasicAsyncLoggerImpl< char >
 Standard char-based logger (ASCII/UTF-8).
 
using CppTrail::wAsyncLoggerImpl = BasicAsyncLoggerImpl< wchar_t >
 Wide-character logger (Platform dependent, typically UTF-16 on Windows).
 
using CppTrail::u8AsyncLoggerImpl = BasicAsyncLoggerImpl< char8_t >
 Explicit UTF-8 logger using C++20 char8_t.
 
using CppTrail::u16AsyncLoggerImpl = BasicAsyncLoggerImpl< char16_t >
 UTF-16 logger using char16_t.
 
using CppTrail::u32AsyncLoggerImpl = BasicAsyncLoggerImpl< char32_t >
 UTF-32 logger using char32_t.
 

Detailed Description

Asynchronous logger implementation using a background worker pool.

This header defines the BasicAsyncLoggerImpl template, providing a decoupled logging architecture where I/O operations are performed by a managed pool of background threads. It includes overflow handling and an asynchronous "killer" mechanism for graceful shutdown.

Author
Dante Doménech Martínez