Logger System 0.1.3
High-performance C++20 thread-safe logging system with asynchronous capabilities
Loading...
Searching...
No Matches
buffered_writer.h File Reference

Decorator that provides buffering for wrapped log writers. More...

#include "decorator_writer_base.h"
#include "../interfaces/log_entry.h"
#include <kcenon/logger/logger_export.h>
#include <atomic>
#include <chrono>
#include <cstdint>
#include <mutex>
#include <vector>
Include dependency graph for buffered_writer.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  kcenon::logger::buffered_writer
 Decorator that buffers log entries before writing to wrapped writer. More...
 
struct  kcenon::logger::buffered_writer::stats
 Statistics for the buffered writer. More...
 

Namespaces

namespace  kcenon
 
namespace  kcenon::logger
 

Functions

std::unique_ptr< buffered_writerkcenon::logger::make_buffered_writer (std::unique_ptr< log_writer_interface > writer, size_t max_entries=buffered_writer::DEFAULT_BUFFER_SIZE, std::chrono::milliseconds flush_interval=buffered_writer::DEFAULT_FLUSH_INTERVAL)
 Factory function to create a buffered writer.
 

Detailed Description

Decorator that provides buffering for wrapped log writers.

Author
kcenon
Since
4.0.0

This file defines the buffered_writer class, a Decorator pattern implementation that wraps any log_writer_interface and buffers log entries before delegating writes. This reduces I/O operations by batching writes and provides configurable buffer size and flush intervals.

Part of the Decorator pattern refactoring (#356).

Definition in file buffered_writer.h.