Logger System 0.1.3
High-performance C++20 thread-safe logging system with asynchronous capabilities
Loading...
Searching...
No Matches
formatted_writer.h
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
5#pragma once
6
41
43
44#include <memory>
45
46namespace kcenon::logger {
47
72public:
85 explicit formatted_writer(std::unique_ptr<log_writer_interface> wrapped,
86 std::unique_ptr<log_formatter_interface> formatter);
87
91 ~formatted_writer() override = default;
92
93 // Non-copyable
96
97 // Movable
98 formatted_writer(formatted_writer&&) noexcept = default;
99 formatted_writer& operator=(formatted_writer&&) noexcept = default;
100
115 common::VoidResult write(const log_entry& entry) override;
116
127 std::string get_name() const override;
128
136 const log_formatter_interface* get_formatter() const;
137
138private:
139 std::unique_ptr<log_formatter_interface> formatter_;
140};
141
153std::unique_ptr<formatted_writer> make_formatted_writer(
154 std::unique_ptr<log_writer_interface> writer,
155 std::unique_ptr<log_formatter_interface> formatter);
156
157} // namespace kcenon::logger
Abstract base class for decorator pattern log writers.
Decorator that applies a formatter to a wrapped writer.
formatted_writer(formatted_writer &&) noexcept=default
formatted_writer(const formatted_writer &)=delete
~formatted_writer() override=default
Destructor.
formatted_writer & operator=(const formatted_writer &)=delete
Abstract interface for log message formatters.
Base interface for all log writers and decorators.
Base class for decorator pattern writers.
Interface for log message formatters (Strategy Pattern) kcenon.
DLL export/import macros for logger_system shared library support.
#define LOGGER_SYSTEM_API
Represents a single log entry with all associated metadata.
Definition log_entry.h:155