Logger System 0.1.3
High-performance C++20 thread-safe logging system with asynchronous capabilities
Loading...
Searching...
No Matches
output_sink_interface.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
22#include <string>
23#include <string_view>
24#include <memory>
25#include <functional>
26#include <kcenon/common/patterns/result.h>
28
29namespace kcenon::logger {
30
41public:
42 virtual ~output_sink_interface() = default;
43
49 virtual common::VoidResult write_raw(std::string_view message) = 0;
50
56
61 virtual bool is_healthy() const = 0;
62
67 virtual std::string get_name() const = 0;
68
73 virtual std::string get_info() const {
74 return "";
75 }
76};
77
78using output_sink_factory = std::function<std::unique_ptr<output_sink_interface>()>;
79
80} // namespace kcenon::logger
Abstract interface for log output destinations (I/O only)
virtual common::VoidResult write_raw(std::string_view message)=0
Write a pre-formatted message to the output destination.
virtual bool is_healthy() const =0
Check if the sink is healthy.
virtual std::string get_info() const
Get sink information.
virtual std::string get_name() const =0
Get the name of this sink.
virtual common::VoidResult flush()=0
Flush any buffered data.
Error codes specific to the logger system.
std::function< std::unique_ptr< output_sink_interface >()> output_sink_factory