21#include <kcenon/common/interfaces/logger_interface.h>
26using log_level = common::interfaces::log_level;
107 "Buffer size must be greater than 0");
110 if (
buffer_size > std::numeric_limits<std::size_t>::max() / 2) {
112 "Buffer size is too large");
118 "Batch size must be greater than 0");
123 "Batch size cannot exceed buffer size");
129 "Flush interval must be non-negative");
134 "Flush interval too large (max 1 hour)");
140 "Max queue size must be greater than 0");
145 "Max queue size must be at least as large as batch size");
151 "Max file size too small (minimum 1KB)");
156 "Max file count must be greater than 0");
161 "Max file count too large (max 1000)");
168 "Remote port must be specified when remote host is set");
173 "Network timeout must be positive");
178 "Network retry count too large (max 100)");
185 "Must allow at least one writer");
190 "Max writers too large (max 100)");
196 "Writer thread count must be at least 1");
201 "Writer thread count too large (max 32)");
207 "Lock-free queue cannot use grow overflow policy");
212 "Batch processing requires async mode");
266 config.
async =
false;
Error codes specific to the logger system.
common::interfaces::log_level log_level
common::VoidResult make_logger_void_result(logger_error_code code, const std::string &message="")
Configuration structure for logger with validation.
log_level min_level
Minimum log level to process.
std::size_t batch_size
Number of messages per batch write.
std::size_t network_retry_count
Number of network retry attempts.
static logger_config low_latency()
Create a low-latency configuration.
common::VoidResult validate() const
Validate the configuration.
std::size_t writer_thread_count
Number of dedicated writer threads.
static logger_config production()
Create a production configuration.
bool enable_batch_writing
Enable batch writing mode.
std::size_t max_file_size
Maximum file size in bytes (default: 100MB).
bool async
Enable asynchronous logging.
std::chrono::milliseconds network_timeout
Network operation timeout.
bool enable_color_output
Enable ANSI color output.
bool enable_timestamp
Include timestamp in log entries.
static logger_config default_config()
Create a default configuration.
overflow_policy queue_overflow_policy
Active overflow policy.
bool enable_source_location
Include source file/line in log entries.
bool enable_compression
Enable log compression.
bool enable_metrics
Enable performance metrics collection.
static logger_config high_performance()
Create a high-performance configuration.
std::string log_directory
Directory for log file output.
std::string remote_host
Remote log collector hostname.
overflow_policy
Policy for handling queue overflow when max_queue_size is reached.
@ drop_newest
Drop new messages when queue is full (default).
@ block
Block until space is available.
@ grow
Dynamically grow the queue (use with caution).
@ drop_oldest
Drop oldest messages when queue is full.
std::chrono::milliseconds flush_interval
Interval between automatic flushes.
std::size_t buffer_size
Internal buffer size in bytes.
uint16_t remote_port
Remote log collector port.
std::size_t max_writers
Maximum number of concurrent writers.
std::size_t max_file_count
Maximum number of rotating log files.
bool enable_crash_handler
Enable crash signal handler.
bool use_lock_free
Use lock-free queue implementation.
std::size_t max_queue_size
Maximum number of queued messages.
bool enable_structured_logging
Enable structured (JSON) log output.
std::string log_file_prefix
Prefix for log file names.
static logger_config debug_config()
Create a debug configuration.
Conditionally enables thread_system integration when available.