mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-06-01 01:54:00 +00:00
update logging to use logger channel
This commit is contained in:
25
tooling/pipeline/src/services/logging/log_producer.cc
Normal file
25
tooling/pipeline/src/services/logging/log_producer.cc
Normal file
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* @file src/services/logging/log_producer.cc
|
||||
* @brief LogProducer implementation for asynchronous pipeline logging.
|
||||
*/
|
||||
|
||||
#include <chrono>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
#include "concurrency/bounded_channel.h"
|
||||
#include "services/logging/log_entry.h"
|
||||
#include "services/logging/log_producer.h"
|
||||
|
||||
LogProducer::LogProducer(BoundedChannel<LogEntry>& channel)
|
||||
: channel_(channel) {}
|
||||
|
||||
void LogProducer::Log(LogLevel level, PipelinePhase phase,
|
||||
const std::string_view message) {
|
||||
channel_.Send(LogEntry{.timestamp = std::chrono::system_clock::now(),
|
||||
.calling_thread_id = std::this_thread::get_id(),
|
||||
.level = level,
|
||||
.phase = phase,
|
||||
.message = std::string(message)});
|
||||
}
|
||||
Reference in New Issue
Block a user