mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-06-01 01:54:00 +00:00
logging updates
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
#define BIERGARTEN_PIPELINE_INCLUDES_SERVICES_DATABASE_EXPORT_SERVICE_H_
|
||||
|
||||
/**
|
||||
* @file services/export_service.h
|
||||
* @file services/database/export_service.h
|
||||
* @brief Abstraction for persisting generated brewery data.
|
||||
*/
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#define BIERGARTEN_PIPELINE_INCLUDES_SERVICES_DATABASE_SQLITE_CONNECTION_HELPERS_H_
|
||||
|
||||
/**
|
||||
* @file services/sqlite_connection_helpers.h
|
||||
* @file services/database/sqlite_connection_helpers.h
|
||||
* @brief Declarations for connection-level SQLite helper functions.
|
||||
*/
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#define BIERGARTEN_PIPELINE_INCLUDES_SERVICES_DATABASE_SQLITE_EXPORT_SERVICE_H_
|
||||
|
||||
/**
|
||||
* @file services/sqlite_export_service.h
|
||||
* @file services/database/sqlite_export_service.h
|
||||
* @brief SQLite-backed export service for generated brewery data.
|
||||
*/
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#define BIERGARTEN_PIPELINE_INCLUDES_SERVICES_DATABASE_SQLITE_STATEMENT_HELPERS_H_
|
||||
|
||||
/**
|
||||
* @file services/sqlite_statement_helpers.h
|
||||
* @file services/database/sqlite_statement_helpers.h
|
||||
* @brief Declarations for statement-level SQLite helper functions and
|
||||
* constants.
|
||||
*/
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#define BIERGARTEN_PIPELINE_INCLUDES_SERVICES_DATETIME_DATE_TIME_PROVIDER_H_
|
||||
|
||||
/**
|
||||
* @file services/date_time_provider.h
|
||||
* @file services/datetime/date_time_provider.h
|
||||
* @brief Abstraction for UTC timestamp generation.
|
||||
*/
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <chrono>
|
||||
|
||||
/**
|
||||
* @file services/timer.h
|
||||
* @file services/datetime/timer.h
|
||||
* @brief Simple timer utility for measuring elapsed time.
|
||||
*/
|
||||
class Timer {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#define BIERGARTEN_PIPELINE_INCLUDES_SERVICES_ENRICHMENT_ENRICHMENT_SERVICE_H_
|
||||
|
||||
/**
|
||||
* @file services/enrichment_service.h
|
||||
* @file services/enrichment/enrichment_service.h
|
||||
* @brief Abstraction for resolving contextual enrichment for a location.
|
||||
*/
|
||||
|
||||
|
||||
@@ -1,15 +1,29 @@
|
||||
//
|
||||
// Created by aaronpo on 13/05/2026.
|
||||
//
|
||||
|
||||
#ifndef BIERGARTEN_PIPELINE_INCLUDES_SERVICES_ENRICHMENT_MOCK_ENRICHMENT_H_
|
||||
#define BIERGARTEN_PIPELINE_INCLUDES_SERVICES_ENRICHMENT_MOCK_ENRICHMENT_H_
|
||||
|
||||
/**
|
||||
* @file services/enrichment/mock_enrichment.h
|
||||
* @brief Mock implementation of enrichment service for testing.
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "enrichment_service.h"
|
||||
|
||||
/**
|
||||
* @brief Mock implementation of enrichment service for testing and prototyping.
|
||||
*
|
||||
* Returns empty context without performing actual web queries or enrichment.
|
||||
* Useful for unit tests and development scenarios.
|
||||
*/
|
||||
class MockEnrichmentService final : public IEnrichmentService {
|
||||
public:
|
||||
/**
|
||||
* @brief Returns empty location context.
|
||||
*
|
||||
* @param loc Unused location parameter.
|
||||
* @return Empty string (no enrichment performed).
|
||||
*/
|
||||
std::string GetLocationContext(const Location& /*loc*/) override {
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#define BIERGARTEN_PIPELINE_INCLUDES_SERVICES_ENRICHMENT_WIKIPEDIA_SERVICE_H_
|
||||
|
||||
/**
|
||||
* @file services/wikipedia_service.h
|
||||
* @file services/enrichment/wikipedia_service.h
|
||||
* @brief Wikipedia summary retrieval service with in-memory caching.
|
||||
*/
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
* them to spdlog on a dedicated thread.
|
||||
*/
|
||||
|
||||
#ifndef BIERGARTEN_PIPELINE_INCLUDES_SERVICES_LOGGING_LOG_CONSUMER_H_
|
||||
#define BIERGARTEN_PIPELINE_INCLUDES_SERVICES_LOGGING_LOG_CONSUMER_H_
|
||||
#ifndef BIERGARTEN_PIPELINE_INCLUDES_SERVICES_LOGGING_LOG_DISPATCHER_H_
|
||||
#define BIERGARTEN_PIPELINE_INCLUDES_SERVICES_LOGGING_LOG_DISPATCHER_H_
|
||||
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
@@ -23,31 +23,31 @@
|
||||
*/
|
||||
class LogDispatcher {
|
||||
public:
|
||||
/**
|
||||
* @brief Construct a log dispatcher.
|
||||
*
|
||||
* @param channel Reference to the bounded channel used for log retrieval.
|
||||
*/
|
||||
explicit LogDispatcher(BoundedChannel<LogEntry>& channel);
|
||||
/**
|
||||
* @brief Construct a log dispatcher.
|
||||
*
|
||||
* @param channel Reference to the bounded channel used for log retrieval.
|
||||
*/
|
||||
explicit LogDispatcher(BoundedChannel<LogEntry>& channel);
|
||||
|
||||
LogDispatcher(const LogDispatcher&) = delete;
|
||||
LogDispatcher& operator=(const LogDispatcher&) = delete;
|
||||
LogDispatcher(LogDispatcher&&) = delete;
|
||||
LogDispatcher& operator=(LogDispatcher&&) = delete;
|
||||
~LogDispatcher() = default;
|
||||
LogDispatcher(const LogDispatcher&) = delete;
|
||||
LogDispatcher& operator=(const LogDispatcher&) = delete;
|
||||
LogDispatcher(LogDispatcher&&) = delete;
|
||||
LogDispatcher& operator=(LogDispatcher&&) = delete;
|
||||
~LogDispatcher() = default;
|
||||
|
||||
/**
|
||||
* @brief Drain the channel and forward entries to spdlog.
|
||||
*
|
||||
* Intended to be called once on a dedicated thread. The loop returns after
|
||||
* the channel has been closed and all queued entries have been processed.
|
||||
*/
|
||||
void Run();
|
||||
/**
|
||||
* @brief Drain the channel and forward entries to spdlog.
|
||||
*
|
||||
* Intended to be called once on a dedicated thread. The loop returns after
|
||||
* the channel has been closed and all queued entries have been processed.
|
||||
*/
|
||||
void Run();
|
||||
|
||||
private:
|
||||
BoundedChannel<LogEntry>& channel_;
|
||||
BoundedChannel<LogEntry>& channel_;
|
||||
|
||||
static spdlog::level::level_enum ToSpdlogLevel(LogLevel level);
|
||||
static spdlog::level::level_enum ToSpdlogLevel(LogLevel level);
|
||||
};
|
||||
|
||||
#endif // BIERGARTEN_PIPELINE_INCLUDES_SERVICES_LOGGING_LOG_CONSUMER_H_
|
||||
#endif // BIERGARTEN_PIPELINE_INCLUDES_SERVICES_LOGGING_LOG_DISPATCHER_H_
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#ifndef BIERGARTEN_PIPELINE_INCLUDES_SERVICES_LOGGING_LOG_ENTRY_H_
|
||||
#define BIERGARTEN_PIPELINE_INCLUDES_SERVICES_LOGGING_LOG_ENTRY_H_
|
||||
|
||||
/**
|
||||
* @file services/logging/log_entry.h
|
||||
* @brief Structured log record shared by the pipeline logging infra.
|
||||
@@ -6,8 +9,6 @@
|
||||
* logging producer and dispatcher through BoundedChannel<LogEntry>.
|
||||
*/
|
||||
|
||||
#ifndef BIERGARTEN_PIPELINE_INCLUDES_SERVICES_LOGGING_LOG_ENTRY_H_
|
||||
#define BIERGARTEN_PIPELINE_INCLUDES_SERVICES_LOGGING_LOG_ENTRY_H_
|
||||
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
* a bounded channel for later processing by the dispatcher.
|
||||
*/
|
||||
|
||||
#ifndef BIERGARTEN_PIPELINE_INCLUDES_SERVICES_LOGGING_CHANNEL_LOGGER_H_
|
||||
#define BIERGARTEN_PIPELINE_INCLUDES_SERVICES_LOGGING_CHANNEL_LOGGER_H_
|
||||
#ifndef BIERGARTEN_PIPELINE_INCLUDES_SERVICES_LOGGING_LOG_PRODUCER_H_
|
||||
#define BIERGARTEN_PIPELINE_INCLUDES_SERVICES_LOGGING_LOG_PRODUCER_H_
|
||||
|
||||
#include <string_view>
|
||||
|
||||
@@ -24,30 +24,29 @@
|
||||
*/
|
||||
class LogProducer final : public ILogger {
|
||||
public:
|
||||
/**
|
||||
* @brief Construct a channel-backed producer.
|
||||
*
|
||||
* @param channel Reference to the bounded channel used for log transfer.
|
||||
*/
|
||||
explicit LogProducer(BoundedChannel<LogEntry>& channel);
|
||||
/**
|
||||
* @brief Construct a channel-backed producer.
|
||||
*
|
||||
* @param channel Reference to the bounded channel used for log transfer.
|
||||
*/
|
||||
explicit LogProducer(BoundedChannel<LogEntry>& channel);
|
||||
|
||||
LogProducer(const LogProducer&) = delete;
|
||||
LogProducer& operator=(const LogProducer&) = delete;
|
||||
LogProducer(LogProducer&&) = delete;
|
||||
LogProducer& operator=(LogProducer&&) = delete;
|
||||
LogProducer(const LogProducer&) = delete;
|
||||
LogProducer& operator=(const LogProducer&) = delete;
|
||||
LogProducer(LogProducer&&) = delete;
|
||||
LogProducer& operator=(LogProducer&&) = delete;
|
||||
|
||||
~LogProducer() override = default;
|
||||
~LogProducer() override = default;
|
||||
|
||||
/**
|
||||
* @brief Queue a log message for asynchronous processing.
|
||||
*
|
||||
* Blocks while the channel applies backpressure.
|
||||
*/
|
||||
void Log(LogLevel level, PipelinePhase phase,
|
||||
std::string_view message) override;
|
||||
/**
|
||||
* @brief Queue a log message for asynchronous processing.
|
||||
*
|
||||
* Blocks while the channel applies backpressure.
|
||||
*/
|
||||
void Log(LogEntry const& entry) override;
|
||||
|
||||
private:
|
||||
BoundedChannel<LogEntry>& channel_;
|
||||
BoundedChannel<LogEntry>& channel_;
|
||||
};
|
||||
|
||||
#endif // BIERGARTEN_PIPELINE_INCLUDES_SERVICES_LOGGING_CHANNEL_LOGGER_H_
|
||||
#endif // BIERGARTEN_PIPELINE_INCLUDES_SERVICES_LOGGING_LOG_PRODUCER_H_
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#ifndef BIERGARTEN_PIPELINE_INCLUDES_SERVICES_LOGGING_LOGGER_H_
|
||||
#define BIERGARTEN_PIPELINE_INCLUDES_SERVICES_LOGGING_LOGGER_H_
|
||||
|
||||
/**
|
||||
* @file services/logging/logger.h
|
||||
* @brief Abstract logging interface used by pipeline components.
|
||||
@@ -6,8 +9,6 @@
|
||||
* transport, buffering, and formatting implementation.
|
||||
*/
|
||||
|
||||
#ifndef BIERGARTEN_PIPELINE_INCLUDES_SERVICES_LOGGING_LOGGER_H_
|
||||
#define BIERGARTEN_PIPELINE_INCLUDES_SERVICES_LOGGING_LOGGER_H_
|
||||
|
||||
#include <optional>
|
||||
#include <string>
|
||||
@@ -24,22 +25,20 @@
|
||||
*/
|
||||
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 entry Structured log record containing message and metadata.
|
||||
*
|
||||
*/
|
||||
virtual void Log(const LogEntry& entry) = 0;
|
||||
};
|
||||
|
||||
#endif // BIERGARTEN_PIPELINE_INCLUDES_SERVICES_LOGGING_LOGGER_H_
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#define BIERGARTEN_PIPELINE_INCLUDES_SERVICES_PROMPTING_PROMPT_DIRECTORY_H_
|
||||
|
||||
/**
|
||||
* @file services/prompt_directory.h
|
||||
* @file services/prompting/prompt_directory.h
|
||||
* @brief Interface and filesystem-backed implementation for named prompt
|
||||
* loading.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user