Misc updates

This commit is contained in:
Aaron Po
2026-05-20 01:53:08 -04:00
parent 20742bb613
commit e251e7b2a3
5 changed files with 62 additions and 47 deletions

View File

@@ -10,8 +10,10 @@
#define BIERGARTEN_PIPELINE_INCLUDES_SERVICES_LOGGING_LOG_ENTRY_H_
#include <chrono>
#include <thread>
#include <source_location>
#include <string>
#include <thread>
#include <vector>
/**
* @enum LogLevel
@@ -53,6 +55,12 @@ struct LogEntry {
std::chrono::system_clock::time_point timestamp =
std::chrono::system_clock::now();
/// @brief Source location where the log call was made.
std::source_location origin = std::source_location::current();
/// @brief Thread responsible for emitting the log.
std::thread::id thread_id = std::this_thread::get_id();
/// @brief Severity level of this entry.
LogLevel level;
@@ -65,4 +73,4 @@ struct LogEntry {
};
#endif // BIERGARTEN_PIPELINE_INCLUDES_SERVICES_LOGGING_LOG_ENTRY_H_
#endif // BIERGARTEN_PIPELINE_INCLUDES_SERVICES_LOGGING_LOG_ENTRY_H_

View File

@@ -43,8 +43,7 @@ class LogProducer final : public ILogger {
*
* Blocks while the channel applies backpressure.
*/
void Log(LogLevel level, PipelinePhase phase,
std::string_view message) override;
void Log(LogEntry log_entry) override;
private:
BoundedChannel<LogEntry>& channel_;

View File

@@ -9,9 +9,9 @@
#ifndef BIERGARTEN_PIPELINE_INCLUDES_SERVICES_LOGGING_LOGGER_H_
#define BIERGARTEN_PIPELINE_INCLUDES_SERVICES_LOGGING_LOGGER_H_
#include <optional>
#include <source_location>
#include <string>
#include <string_view>
#include <utility>
#include "services/logging/log_entry.h"
@@ -24,22 +24,19 @@
*/
class ILogger {
public:
ILogger() = default;
ILogger(const ILogger&) = delete;
ILogger& operator=(const ILogger&) = delete;
ILogger(ILogger&&) = delete;
ILogger& operator=(ILogger&&) = delete;
virtual ~ILogger() = default;
ILogger() = default;
ILogger(const ILogger&) = delete;
ILogger& operator=(const ILogger&) = delete;
ILogger(ILogger&&) = delete;
ILogger& operator=(ILogger&&) = delete;
virtual ~ILogger() = default;
/**
* @brief Submit a log message to the logging subsystem.
*
* @param level Severity of the message.
* @param phase Pipeline execution phase associated with the message.
* @param message Log message text.
*/
virtual void Log(LogLevel level, PipelinePhase phase,
std::string_view message) = 0;
/**
* @brief Submit a log message to the logging subsystem.
*
* @param log_entry Structured log entry data.
*/
virtual void Log(LogEntry log_entry) = 0;
};
#endif // BIERGARTEN_PIPELINE_INCLUDES_SERVICES_LOGGING_LOGGER_H_