update logging to use logger channel

This commit is contained in:
Aaron Po
2026-05-15 01:13:53 -04:00
parent a4968eb043
commit e6a20324e4
35 changed files with 561 additions and 404 deletions

View 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)});
}