44#include <unordered_map>
50#include <kcenon/common/interfaces/logger_interface.h>
58using log_level = common::interfaces::log_level;
69using log_value = std::variant<std::string, int64_t, double, bool>;
75using log_fields = std::unordered_map<std::string, log_value>;
232 const std::string& msg,
233 std::chrono::system_clock::time_point ts = std::chrono::system_clock::now())
262 const std::string& msg,
263 const std::string& file,
265 const std::string& function,
266 std::chrono::system_clock::time_point ts = std::chrono::system_clock::now())
common::interfaces::log_level log_level
std::unordered_map< std::string, log_value > log_fields
Type alias for structured fields map.
std::variant< std::string, int64_t, double, bool > log_value
Value type for structured logging fields.
OpenTelemetry context structure for trace correlation kcenon.
Small String Optimization (SSO) for short log messages.
Represents a single log entry with all associated metadata.
std::optional< source_location > location
Optional source code location information.
log_entry(log_level lvl, const std::string &msg, const std::string &file, int line, const std::string &function, std::chrono::system_clock::time_point ts=std::chrono::system_clock::now())
std::optional< log_fields > fields
Optional structured fields for key-value logging.
std::optional< small_string_64 > thread_id
Optional thread identifier.
std::optional< otlp::otel_context > otel_ctx
Optional OpenTelemetry context for trace correlation.
log_level level
Severity level of the log message.
log_entry(log_entry &&) noexcept=default
Move constructor.
log_entry(log_level lvl, const std::string &msg, std::chrono::system_clock::time_point ts=std::chrono::system_clock::now())
std::optional< small_string_128 > category
Optional category for log filtering and routing.
small_string_256 message
The actual log message.
std::chrono::system_clock::time_point timestamp
Timestamp when the log entry was created.
Source code location information for debugging.
small_string_128 function
Function or method name.
small_string_256 file
Source file path.
int line
Line number in the source file.
source_location(const char *f="", int l=0, const char *func="")
Construct source location from C-strings.
source_location(const std::string &f="", int l=0, const std::string &func="")
Construct source location from std::string.