|
Logger System 0.1.3
High-performance C++20 thread-safe logging system with asynchronous capabilities
|
Factory for creating log writer instances. More...
#include <writer_factory.h>

Public Types | |
| using | creator_fn = std::function<log_writer_ptr()> |
Static Public Member Functions | |
| static log_writer_ptr | create_console (bool use_stderr=false, bool auto_detect_color=true) |
| Create a console writer. | |
| static log_writer_ptr | create_file (const std::string &filename, bool append=true, std::size_t buffer_size=8192) |
| Create a file writer. | |
| static log_writer_ptr | create_rotating_file (const std::string &filename, std::size_t max_size, std::size_t max_files, std::size_t check_interval=100) |
| Create a rotating file writer (size-based) | |
| static log_writer_ptr | create_rotating_file (const std::string &filename, rotation_type type, std::size_t max_files, std::size_t check_interval=100) |
| Create a rotating file writer (time-based) | |
| static log_writer_ptr | create_network (const std::string &host, uint16_t port, network_writer::protocol_type protocol=network_writer::protocol_type::tcp, std::size_t buffer_size=8192, std::chrono::seconds reconnect_interval=std::chrono::seconds(5)) |
| Create a network writer. | |
| static log_writer_ptr | create_batch (log_writer_ptr writer, std::size_t batch_size=100, std::chrono::milliseconds flush_interval=std::chrono::milliseconds(1000)) |
| Wrap a writer with batch processing. | |
| static log_writer_ptr | create_development () |
| Create a development preset writer. | |
| static log_writer_ptr | create_production (const std::string &log_directory="./logs", const std::string &filename="app.log") |
| Create a production preset writer. | |
| static log_writer_ptr | create_high_performance (const std::string &filename="./logs/app.log") |
| Create a high-performance preset writer. | |
| static void | register_type (const std::string &name, creator_fn creator) |
| Register a custom writer type. | |
| static log_writer_ptr | create (const std::string &name) |
| Create a writer by registered name. | |
| static bool | has_type (const std::string &name) |
| Check if a writer type is registered. | |
Static Private Member Functions | |
| static std::unordered_map< std::string, creator_fn > & | registry () |
Factory for creating log writer instances.
Provides static factory methods for all built-in writer types and a registry pattern for custom writer types.
Definition at line 40 of file writer_factory.h.
| using kcenon::logger::writer_factory::creator_fn = std::function<log_writer_ptr()> |
Definition at line 42 of file writer_factory.h.
|
inlinestatic |
Create a writer by registered name.
| name | Registered type name |
Definition at line 214 of file writer_factory.h.
References registry().

|
inlinestatic |
Wrap a writer with batch processing.
| writer | The writer to wrap |
| batch_size | Maximum batch size |
| flush_interval | Auto-flush interval |
Definition at line 142 of file writer_factory.h.
References kcenon::logger::batch_writer::config::flush_interval, and kcenon::logger::batch_writer::config::max_batch_size.
Referenced by create_high_performance(), and create_production().

|
inlinestatic |
Create a console writer.
| use_stderr | Send output to stderr (default: stdout) |
| auto_detect_color | Auto-detect terminal color support |
Definition at line 54 of file writer_factory.h.
Referenced by create_development().

|
inlinestatic |
Create a development preset writer.
Definition at line 161 of file writer_factory.h.
References create_console().

|
inlinestatic |
Create a file writer.
| filename | Path to log file |
| append | Append to existing file (default: true) |
| buffer_size | Output buffer size |
Definition at line 68 of file writer_factory.h.
|
inlinestatic |
Create a high-performance preset writer.
| filename | Log file path |
Definition at line 189 of file writer_factory.h.
References create_batch().

|
inlinestatic |
Create a network writer.
| host | Remote host address |
| port | Remote port |
| protocol | Network protocol (TCP/UDP) |
| buffer_size | Internal buffer size |
| reconnect_interval | Reconnection interval |
Definition at line 123 of file writer_factory.h.
|
inlinestatic |
Create a production preset writer.
| log_directory | Directory for log files |
| filename | Log file name |
Definition at line 171 of file writer_factory.h.
References create_batch(), and create_rotating_file().

|
inlinestatic |
Create a rotating file writer (time-based)
| filename | Path to log file |
| type | Rotation type (daily/hourly) |
| max_files | Maximum number of backup files |
| check_interval | Writes between rotation checks |
Definition at line 103 of file writer_factory.h.
|
inlinestatic |
Create a rotating file writer (size-based)
| filename | Path to log file |
| max_size | Maximum file size before rotation |
| max_files | Maximum number of backup files |
| check_interval | Writes between rotation checks |
Definition at line 84 of file writer_factory.h.
Referenced by create_production().

|
inlinestatic |
Check if a writer type is registered.
| name | Type name to check |
Definition at line 227 of file writer_factory.h.
References registry().

|
inlinestatic |
Register a custom writer type.
| name | Type name for the writer |
| creator | Factory function to create the writer |
Definition at line 205 of file writer_factory.h.
References registry().

|
inlinestaticprivate |
Definition at line 232 of file writer_factory.h.
Referenced by create(), has_type(), and register_type().
