Logger System 0.1.3
High-performance C++20 thread-safe logging system with asynchronous capabilities
Loading...
Searching...
No Matches
log_collector.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
17#include <kcenon/common/interfaces/logger_interface.h>
20
21#include <atomic>
22#include <chrono>
23#include <memory>
24#include <vector>
25
26namespace kcenon::logger {
27
35public:
43 explicit log_collector(std::size_t buffer_size = 8192, std::size_t batch_size = 100);
44
49
59 bool enqueue(common::interfaces::log_level level,
60 const std::string& message,
61 const std::string& file,
62 int line,
63 const std::string& function,
64 const std::chrono::system_clock::time_point& timestamp);
65
73 void add_writer(std::shared_ptr<log_writer_interface> writer);
74
78 void clear_writers();
79
83 void start();
84
88 void stop();
89
93 void flush();
94
99 std::pair<size_t, size_t> get_queue_metrics() const;
100
101private:
102 class impl;
103 std::unique_ptr<impl> pimpl_;
104};
105
106} // namespace kcenon::logger
Asynchronous log collector for high-performance logging.
std::unique_ptr< impl > pimpl_
Base interface for all log writers and decorators.
DLL export/import macros for logger_system shared library support.
#define LOGGER_SYSTEM_API