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

Public Types | |
| using | creator_fn = std::function<std::unique_ptr<log_formatter_interface>()> |
Static Public Member Functions | |
| static std::unique_ptr< log_formatter_interface > | create_plain (const format_options &opts=format_options{}) |
| Create a plain/timestamp formatter. | |
| static std::unique_ptr< log_formatter_interface > | create_json (const format_options &opts=format_options{}) |
| Create a JSON formatter. | |
| static std::unique_ptr< log_formatter_interface > | create_logfmt (const format_options &opts=format_options{}) |
| Create a logfmt formatter. | |
| static std::unique_ptr< log_formatter_interface > | create_template (const std::string &template_pattern=template_formatter::DEFAULT_TEMPLATE, const format_options &opts=format_options{}) |
| Create a template formatter with custom pattern. | |
| static std::unique_ptr< log_formatter_interface > | create_compact () |
| Create a compact formatter. | |
| static std::unique_ptr< log_formatter_interface > | create (format_type type, const format_options &opts=format_options{}) |
| Create a formatter by type enum. | |
| static std::unique_ptr< log_formatter_interface > | create_development () |
| Create a development formatter. | |
| static std::unique_ptr< log_formatter_interface > | create_production () |
| Create a production formatter. | |
| static std::unique_ptr< log_formatter_interface > | create_minimal () |
| Create a minimal formatter. | |
| static void | register_type (const std::string &name, creator_fn creator) |
| Register a custom formatter type. | |
| static std::unique_ptr< log_formatter_interface > | create (const std::string &name) |
| Create a formatter by registered name. | |
| static bool | has_type (const std::string &name) |
| Check if a formatter type is registered. | |
Static Private Member Functions | |
| static std::unordered_map< std::string, creator_fn > & | registry () |
Factory for creating log formatter instances.
Provides static factory methods for all built-in formatter types and a registry pattern for custom formatter types.
Definition at line 50 of file formatter_factory.h.
| using kcenon::logger::formatter_factory::creator_fn = std::function<std::unique_ptr<log_formatter_interface>()> |
Definition at line 52 of file formatter_factory.h.
|
inlinestatic |
Create a formatter by registered name.
| name | Registered type name |
Definition at line 211 of file formatter_factory.h.
References registry().

|
inlinestatic |
Create a formatter by type enum.
| type | Format type |
| opts | Format options (for customization) |
Definition at line 128 of file formatter_factory.h.
|
inlinestatic |
Create a compact formatter.
Compact format: minimal overhead, single line
Definition at line 112 of file formatter_factory.h.
References kcenon::logger::format_options::include_level, kcenon::logger::format_options::include_source_location, kcenon::logger::format_options::include_thread_id, kcenon::logger::format_options::include_timestamp, and kcenon::logger::format_options::use_colors.
|
inlinestatic |
Create a development formatter.
Definition at line 155 of file formatter_factory.h.
References create_plain(), kcenon::logger::format_options::include_level, kcenon::logger::format_options::include_source_location, kcenon::logger::format_options::include_thread_id, kcenon::logger::format_options::include_timestamp, and kcenon::logger::format_options::use_colors.

|
inlinestatic |
Create a JSON formatter.
| opts | Format options |
Definition at line 74 of file formatter_factory.h.
Referenced by create_production().

|
inlinestatic |
Create a logfmt formatter.
| opts | Format options |
Definition at line 86 of file formatter_factory.h.
|
inlinestatic |
Create a minimal formatter.
Definition at line 183 of file formatter_factory.h.
References create_plain(), kcenon::logger::format_options::include_level, kcenon::logger::format_options::include_source_location, kcenon::logger::format_options::include_thread_id, kcenon::logger::format_options::include_timestamp, and kcenon::logger::format_options::use_colors.

|
inlinestatic |
Create a plain/timestamp formatter.
| opts | Format options |
Definition at line 63 of file formatter_factory.h.
Referenced by create_development(), and create_minimal().

|
inlinestatic |
Create a production formatter.
Definition at line 169 of file formatter_factory.h.
References create_json(), kcenon::logger::format_options::include_level, kcenon::logger::format_options::include_source_location, kcenon::logger::format_options::include_thread_id, kcenon::logger::format_options::include_timestamp, and kcenon::logger::format_options::use_colors.

|
inlinestatic |
Create a template formatter with custom pattern.
| template_pattern | Template string with placeholders |
| opts | Format options |
Definition at line 99 of file formatter_factory.h.
|
inlinestatic |
Check if a formatter type is registered.
| name | Type name to check |
Definition at line 224 of file formatter_factory.h.
References registry().

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

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