mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-06-01 01:54:00 +00:00
38 lines
1.2 KiB
C++
38 lines
1.2 KiB
C++
/**
|
|
* @file services/logging/channel_logger.h
|
|
* @brief Channel-backed implementation of the Logger interface.
|
|
*
|
|
* ChannelLogger constructs LogEntry values and forwards them to a
|
|
* BoundedChannel<LogEntry> for asynchronous consumption by LogConsumer.
|
|
* The channel is injected by reference; ChannelLogger does not own it.
|
|
*/
|
|
|
|
#ifndef BIERGARTEN_PIPELINE_INCLUDES_SERVICES_LOGGING_CHANNEL_LOGGER_H_
|
|
#define BIERGARTEN_PIPELINE_INCLUDES_SERVICES_LOGGING_CHANNEL_LOGGER_H_
|
|
|
|
#include <string_view>
|
|
|
|
#include "concurrency/bounded_channel.h"
|
|
#include "services/logging/log_entry.h"
|
|
#include "services/logging/logger.h"
|
|
|
|
class ChannelLogger final : public ILogger {
|
|
public:
|
|
explicit ChannelLogger(BoundedChannel<LogEntry>& channel);
|
|
|
|
ChannelLogger(const ChannelLogger&) = delete;
|
|
ChannelLogger& operator=(const ChannelLogger&) = delete;
|
|
ChannelLogger(ChannelLogger&&) = delete;
|
|
ChannelLogger& operator=(ChannelLogger&&) = delete;
|
|
|
|
~ChannelLogger() override = default;
|
|
|
|
void Log(LogLevel level, PipelinePhase phase,
|
|
std::string_view message) override;
|
|
|
|
private:
|
|
BoundedChannel<LogEntry>& channel_;
|
|
};
|
|
|
|
#endif // BIERGARTEN_PIPELINE_INCLUDES_SERVICES_LOGGING_CHANNEL_LOGGER_H_
|