Logger System 0.1.3
High-performance C++20 thread-safe logging system with asynchronous capabilities
Loading...
Searching...
No Matches
decorator_writer_base.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
39
41
42#include <memory>
43#include <string>
44#include <string_view>
45
46namespace kcenon::logger {
47
72public:
83 explicit decorator_writer_base(std::unique_ptr<log_writer_interface> wrapped,
84 std::string_view decorator_name);
85
89 ~decorator_writer_base() override = default;
90
91 // Non-copyable
94
95 // Movable
97 decorator_writer_base& operator=(decorator_writer_base&&) noexcept = default;
98
107 common::VoidResult write(const log_entry& entry) override = 0;
108
119 common::VoidResult flush() override;
120
131 std::string get_name() const override;
132
143 bool is_healthy() const override;
144
152 const log_writer_interface* get_wrapped_writer() const noexcept;
153
154protected:
164 log_writer_interface& wrapped() noexcept;
165
173 const log_writer_interface& wrapped() const noexcept;
174
182 const std::string& decorator_name() const noexcept;
183
184private:
185 std::unique_ptr<log_writer_interface> wrapped_;
186 std::string decorator_name_;
187};
188
189} // namespace kcenon::logger
Abstract base class for decorator pattern log writers.
decorator_writer_base(decorator_writer_base &&) noexcept=default
decorator_writer_base(const decorator_writer_base &)=delete
~decorator_writer_base() override=default
Virtual destructor for proper cleanup.
decorator_writer_base & operator=(const decorator_writer_base &)=delete
Base interface for all log writers and decorators.
Base interface for all log writers and decorators.
DLL export/import macros for logger_system shared library support.
#define LOGGER_SYSTEM_API
Tag interface for decorator writers.
Represents a single log entry with all associated metadata.
Definition log_entry.h:155
Writer category interfaces and type traits kcenon.