31 if (config1_result.is_ok()) {
32 std::cout <<
"Production config created successfully" << std::endl;
33 std::cout <<
" Buffer size: " << config1_result.value().buffer_size << std::endl;
34 std::cout <<
" Log directory: " << config1_result.value().log_directory << std::endl;
44 if (config2_result.is_ok()) {
45 std::cout <<
"\nDebug config created successfully" << std::endl;
46 std::cout <<
" Async: " << config2_result.value().async << std::endl;
47 std::cout <<
" Source location: " << config2_result.value().enable_source_location << std::endl;
64 if (config3_result.is_ok()) {
65 std::cout <<
"\nCustom config created successfully" << std::endl;
66 std::cout <<
" Buffer size: " << config3_result.value().buffer_size << std::endl;
67 std::cout <<
" Batch size: " << config3_result.value().batch_size << std::endl;
68 std::cout <<
" Max queue size: " << config3_result.value().max_queue_size << std::endl;
79 if (config4_result.is_ok()) {
80 std::cout <<
"\nHigh-performance network config created successfully" << std::endl;
81 std::cout <<
" Remote host: " << config4_result.value().remote_host << std::endl;
82 std::cout <<
" Remote port: " << config4_result.value().remote_port << std::endl;
90 if (!config5_result.is_ok()) {
91 std::cout <<
"\nValidation failed as expected:" << std::endl;
92 std::cout <<
" Error: " << config5_result.error().message << std::endl;
Fluent builder for logger_config.
logger_config_builder & enable_timestamp(bool enabled)
Enable/disable timestamp in log messages.
logger_config_builder & set_buffer_size(std::size_t size)
Set buffer size.
logger_config_builder & set_network_retry_count(std::size_t count)
Set network retry count.
logger_config_builder & enable_metrics(bool enabled)
Enable/disable metrics collection.
logger_config_builder & set_flush_interval(std::chrono::milliseconds interval)
Set flush interval.
logger_config_builder & use_debug_defaults()
Use debug configuration as base.
logger_config_builder & set_network_timeout(std::chrono::milliseconds timeout)
Set network timeout.
logger_config_builder & use_production_defaults()
Use production configuration as base.
logger_config_builder & set_overflow_policy(logger_config::overflow_policy policy)
Set queue overflow policy.
logger_config_builder & enable_source_location(bool enabled)
Enable/disable source location in log messages.
logger_config_builder & set_log_directory(const std::string &directory)
Set log directory.
logger_config_builder & use_high_performance_defaults()
Use high-performance configuration as base.
logger_config_builder & set_max_queue_size(std::size_t size)
Set maximum queue size.
logger_config_builder & set_async(bool enabled)
Set asynchronous logging mode.
result< logger_config > build() const
Build the logger_config.
logger_config_builder & set_log_file_prefix(const std::string &prefix)
Set log file prefix.
logger_config_builder & set_remote_logging(const std::string &host, uint16_t port)
Set remote logging host.
logger_config_builder & set_batch_size(std::size_t size)
Set batch size for batch writing.
logger_config_builder & enable_color_output(bool enabled)
Enable/disable color output.
Fluent builder for logger_config.