diff --git a/tooling/pipeline/includes/services/logging/log_dispatcher.h b/tooling/pipeline/includes/services/logging/log_dispatcher.h index c2104bf6..cde928d2 100644 --- a/tooling/pipeline/includes/services/logging/log_dispatcher.h +++ b/tooling/pipeline/includes/services/logging/log_dispatcher.h @@ -22,32 +22,32 @@ * and exit once the channel has been closed and drained. */ class LogDispatcher { - public: - /** - * @brief Construct a log dispatcher. - * - * @param channel Reference to the bounded channel used for log retrieval. - */ - explicit LogDispatcher(BoundedChannel& channel); + public: + /** + * @brief Construct a log dispatcher. + * + * @param channel Reference to the bounded channel used for log retrieval. + */ + explicit LogDispatcher(BoundedChannel& 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& channel_; + private: + BoundedChannel& channel_; - static spdlog::level::level_enum ToSpdlogLevel(LogLevel level); + static spdlog::level::level_enum ToSpdlogLevel(LogLevel level); }; #endif // BIERGARTEN_PIPELINE_INCLUDES_SERVICES_LOGGING_LOG_DISPATCHER_H_ diff --git a/tooling/pipeline/includes/services/logging/log_entry.h b/tooling/pipeline/includes/services/logging/log_entry.h index 11131da3..ab1eaa8f 100644 --- a/tooling/pipeline/includes/services/logging/log_entry.h +++ b/tooling/pipeline/includes/services/logging/log_entry.h @@ -20,22 +20,22 @@ * @brief Severity levels supported by the logging infra. */ enum class LogLevel { - /** - * @brief Development/debugging information. - */ - Debug, - /** - * @brief General informational messages. - */ - Info, - /** - * @brief Warning conditions. - */ - Warn, - /** - * @brief Error conditions. - */ - Error, + /** + * @brief Development/debugging information. + */ + Debug, + /** + * @brief General informational messages. + */ + Info, + /** + * @brief Warning conditions. + */ + Warn, + /** + * @brief Error conditions. + */ + Error, }; /** @@ -46,38 +46,38 @@ enum class LogLevel { * pipeline that emitted it. */ enum class PipelinePhase { - /** - * @brief Initialization and validation. - */ - Startup, - /** - * @brief City/context enrichment (e.g. Wikipedia lookups). - */ - Enrichment, - /** - * @brief User profile generation. - */ - UserGeneration, - /** - * @brief Brewery and beer data generation. - */ - BreweryAndBeerGeneration, - /** - * @brief Checkin (visit) record generation. - */ - CheckinGeneration, - /** - * @brief Rating and review generation. - */ - RatingGeneration, - /** - * @brief Follow relationship generation. - */ - FollowGeneration, - /** - * @brief Finalization and cleanup. - */ - Teardown, + /** + * @brief Initialization and validation. + */ + Startup, + /** + * @brief City/context enrichment (e.g. Wikipedia lookups). + */ + Enrichment, + /** + * @brief User profile generation. + */ + UserGeneration, + /** + * @brief Brewery and beer data generation. + */ + BreweryAndBeerGeneration, + /** + * @brief Checkin (visit) record generation. + */ + CheckinGeneration, + /** + * @brief Rating and review generation. + */ + RatingGeneration, + /** + * @brief Follow relationship generation. + */ + FollowGeneration, + /** + * @brief Finalization and cleanup. + */ + Teardown, }; /** @@ -86,9 +86,9 @@ enum class PipelinePhase { * transparently. */ struct LogDTO { - LogLevel level; - PipelinePhase phase; - std::string message; + LogLevel level; + PipelinePhase phase; + std::string message; }; /** @@ -102,35 +102,35 @@ struct LogDTO { * before the entry is dispatched. */ struct LogEntry { - /** - * @brief Timestamp when the entry was created. - */ - std::chrono::system_clock::time_point timestamp{}; + /** + * @brief Timestamp when the entry was created. + */ + std::chrono::system_clock::time_point timestamp{}; - /** - * @brief Source location where the log call was made. - */ - std::source_location origin{}; + /** + * @brief Source location where the log call was made. + */ + std::source_location origin{}; - /** - * @brief Thread responsible for emitting the log. - */ - std::thread::id thread_id{}; + /** + * @brief Thread responsible for emitting the log. + */ + std::thread::id thread_id{}; - /** - * @brief Severity level of this entry. - */ - LogLevel level; + /** + * @brief Severity level of this entry. + */ + LogLevel level; - /** - * @brief Pipeline phase associated with the entry. - */ - PipelinePhase phase; + /** + * @brief Pipeline phase associated with the entry. + */ + PipelinePhase phase; - /** - * @brief Log message text. - */ - std::string message; + /** + * @brief Log message text. + */ + std::string message; }; #endif // BIERGARTEN_PIPELINE_INCLUDES_SERVICES_LOGGING_LOG_ENTRY_H_ diff --git a/tooling/pipeline/includes/services/logging/log_producer.h b/tooling/pipeline/includes/services/logging/log_producer.h index 253c016c..e7bdfe50 100644 --- a/tooling/pipeline/includes/services/logging/log_producer.h +++ b/tooling/pipeline/includes/services/logging/log_producer.h @@ -23,31 +23,31 @@ * remain valid for the lifetime of the producer. */ 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& channel); + public: + /** + * @brief Construct a channel-backed producer. + * + * @param channel Reference to the bounded channel used for log transfer. + */ + explicit LogProducer(BoundedChannel& 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. This blocking behavior - * under heavy load is an accepted trade-off for simplicity. - */ - void DoLog(LogEntry log_entry) override; + /** + * @brief Queue a log message for asynchronous processing. + * + * Blocks while the channel applies backpressure. This blocking behavior + * under heavy load is an accepted trade-off for simplicity. + */ + void DoLog(LogEntry log_entry) override; - private: - BoundedChannel& channel_; + private: + BoundedChannel& channel_; }; #endif // BIERGARTEN_PIPELINE_INCLUDES_SERVICES_LOGGING_LOG_PRODUCER_H_ diff --git a/tooling/pipeline/includes/services/logging/logger.h b/tooling/pipeline/includes/services/logging/logger.h index 31505d98..e666b513 100644 --- a/tooling/pipeline/includes/services/logging/logger.h +++ b/tooling/pipeline/includes/services/logging/logger.h @@ -23,43 +23,43 @@ * by the composition root and injected into services that emit diagnostics. */ class ILogger { - public: - ILogger() = default; - ILogger(const ILogger&) = delete; - ILogger& operator=(const ILogger&) = delete; - ILogger(ILogger&&) = delete; - ILogger& operator=(ILogger&&) = delete; - virtual ~ILogger() = default; + public: + 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 payload User-provided log data (level, phase, message). - * @param origin Auto-captured source location of the call site. - */ - void Log(LogDTO payload, - std::source_location origin = std::source_location::current(), - std::chrono::system_clock::time_point timestamp = - std::chrono::system_clock::now(), - std::thread::id thread_id = std::this_thread::get_id()) { - LogEntry entry; - entry.timestamp = timestamp; - entry.thread_id = thread_id; - entry.level = payload.level; - entry.phase = payload.phase; - entry.message = std::move(payload.message); - entry.origin = origin; - DoLog(std::move(entry)); - } + /** + * @brief Submit a log message to the logging subsystem. + * + * @param payload User-provided log data (level, phase, message). + * @param origin Auto-captured source location of the call site. + */ + void Log(LogDTO payload, + std::source_location origin = std::source_location::current(), + std::chrono::system_clock::time_point timestamp = + std::chrono::system_clock::now(), + std::thread::id thread_id = std::this_thread::get_id()) { + LogEntry entry; + entry.timestamp = timestamp; + entry.thread_id = thread_id; + entry.level = payload.level; + entry.phase = payload.phase; + entry.message = std::move(payload.message); + entry.origin = origin; + DoLog(std::move(entry)); + } - protected: - /** - * @brief Underlying implementation to transport the log entry. - * - * Implementations must be thread-safe as DoLog can be called concurrently - * from multiple worker threads. - */ - virtual void DoLog(LogEntry log_entry) = 0; + protected: + /** + * @brief Underlying implementation to transport the log entry. + * + * Implementations must be thread-safe as DoLog can be called concurrently + * from multiple worker threads. + */ + virtual void DoLog(LogEntry log_entry) = 0; }; #endif // BIERGARTEN_PIPELINE_INCLUDES_SERVICES_LOGGING_LOGGER_H_