Logger System 0.1.3
High-performance C++20 thread-safe logging system with asynchronous capabilities
Loading...
Searching...
No Matches
thread_safe_writer.cpp
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
7
8namespace kcenon::logger {
9
10thread_safe_writer::thread_safe_writer(std::unique_ptr<log_formatter_interface> formatter)
11 : base_writer(std::move(formatter)) {
12}
13
15 std::lock_guard<std::mutex> lock(write_mutex_);
16 return write_entry_impl(entry);
17}
18
20 std::lock_guard<std::mutex> lock(write_mutex_);
21 return flush_impl();
22}
23
24} // namespace kcenon::logger
Abstract base class for all log output writers.
Definition base_writer.h:95
virtual common::VoidResult write_entry_impl(const log_entry &entry)=0
Implementation of structured write operation (override in derived classes)
common::VoidResult write(const log_entry &entry) final
Thread-safe write operation for structured log entries.
common::VoidResult flush() final
Thread-safe flush operation.
thread_safe_writer(std::unique_ptr< log_formatter_interface > formatter=nullptr)
Constructor with optional formatter.
virtual common::VoidResult flush_impl()=0
Implementation of flush operation (override in derived classes)
Data structures for representing log entries and source locations kcenon.
Represents a single log entry with all associated metadata.
Definition log_entry.h:155
Thread-safe base class for writer implementations kcenon.