Logger System 0.1.3
High-performance C++20 thread-safe logging system with asynchronous capabilities
Loading...
Searching...
No Matches
core.cppm
Go to the documentation of this file.
1// BSD 3-Clause License
2// Copyright (c) 2025, 🍀☀🌕🌥 🌊
3// See the LICENSE file in the project root for full license information.
4
21export module kcenon.logger:core;
22
23// Standard library imports
24import <atomic>;
25import <chrono>;
26import <memory>;
27import <mutex>;
28import <string>;
29import <string_view>;
30import <thread>;
31import <vector>;
32
33// Import common_system dependencies
34import kcenon.common;
35
36// Export core classes
37export {
38 // Include the actual headers - these will be converted to module implementation
39 // For now, we re-export the header content as module interface
40
41 // Core types and enumerations
42 namespace logger_system {
43 enum class overflow_policy {
44 block,
47 grow
48 };
49
50 enum class health_status {
51 healthy,
55 };
56
78 }
79
80 // Core namespace exports
81 namespace kcenon::logger {
82 // Type aliases - use common::interfaces::log_level
83 using log_level = common::interfaces::log_level;
86
87 namespace core {
91 struct log_context {
92 std::string_view file{"unknown"};
93 int line{0};
94 std::string_view function{"unknown"};
95 std::thread::id thread_id{std::this_thread::get_id()};
96 std::chrono::time_point<std::chrono::system_clock> timestamp{
97 std::chrono::system_clock::now()};
98 };
99
103 inline log_context make_log_context(std::string_view file,
104 int line,
105 std::string_view function) {
106 log_context ctx;
107 ctx.file = file;
108 ctx.line = line;
109 ctx.function = function;
110 ctx.thread_id = std::this_thread::get_id();
111 ctx.timestamp = std::chrono::system_clock::now();
112 return ctx;
113 }
114 }
115
116 // Forward declarations for core classes
117 class logger;
118 class log_collector;
119 class base_writer;
120 class console_writer;
121 class file_writer;
122 class rotating_file_writer;
123 class network_writer;
124 class async_writer;
125 class batch_writer;
126 class critical_writer;
127 class composite_writer;
128
129 // Forward declarations for formatters
130 namespace formatters {
131 class base_formatter;
132 class json_formatter;
133 class timestamp_formatter;
134 }
135
136 // Forward declarations for filters
137 namespace filters {
138 class log_filter;
139 }
140
141 // Forward declarations for interfaces
142 class log_entry;
143 class log_filter_interface;
144 class log_formatter_interface;
145 class log_writer_interface;
146 class log_sink_interface;
147 class output_sink_interface;
148
149 // Forward declarations for metrics
150 namespace metrics {
151 struct logger_performance_stats;
152 }
153
154 // Forward declarations for security
155 namespace security {
156 class signal_manager;
157 class critical_logger_interface;
158 }
159
160 // Forward declarations for strategies
161 namespace strategies {
166 class composite_strategy;
167 }
168
169 // Forward declarations for builders
170 class logger_builder;
172 struct logger_config;
173 }
174}
Combines multiple configuration strategies.
Abstract interface for logger configuration strategies.
Configuration strategy based on deployment environment.
Configuration strategy based on environment variables.
Builder pattern for logger construction with validation.
Fluent builder for logger_config.
Configuration strategy for performance tuning.
common::interfaces::log_level log_level
log_context make_log_context(std::string_view file, int line, std::string_view function)
Create a log context with source location.
Definition log_context.h:26
logger_system::overflow_policy overflow_policy
Definition logger.h:88
health_status
Health status levels.
overflow_policy
Overflow policy for when buffers are full.
health_status
Health status enumeration.
logger_error_code
Logger error codes.
Log context containing source location information.
Definition core.cppm:91
std::chrono::time_point< std::chrono::system_clock > timestamp
Definition log_context.h:22
Configuration structure for logger with validation.