14 std::unique_ptr<log_formatter_interface> formatter)
26 std::string formatted_message =
formatter_->format(entry);
56 std::unique_ptr<log_writer_interface> writer,
57 std::unique_ptr<log_formatter_interface> formatter) {
58 return std::make_unique<formatted_writer>(std::move(writer), std::move(formatter));
Abstract base class for decorator pattern log writers.
std::string get_name() const override
Get the name of this writer.
log_writer_interface & wrapped() noexcept
Access the wrapped writer (non-const)
virtual std::string get_name() const =0
virtual common::VoidResult write(const log_entry &entry)=0
Write a log entry.
Data structures for representing log entries and source locations kcenon.
std::unique_ptr< formatted_writer > make_formatted_writer(std::unique_ptr< log_writer_interface > writer, std::unique_ptr< log_formatter_interface > formatter)
Factory function to create a formatted writer.
Represents a single log entry with all associated metadata.
std::optional< source_location > location
Optional source code location information.
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.
std::optional< small_string_128 > category
Optional category for log filtering and routing.
std::chrono::system_clock::time_point timestamp
Timestamp when the log entry was created.