From 4216469674c9d28d2c592769a26168f32236f520 Mon Sep 17 00:00:00 2001 From: Ryan Date: Tue, 31 Dec 2024 00:55:43 +0100 Subject: [PATCH] Enable Seafire diagnostics --- code/build/web/augmentation.cxx | 13 +++++++++++-- code/build/web/augmentation.hxx | 4 ++-- code/build/web/diagnostics.cxx | 11 +++++++++++ code/build/web/diagnostics.hxx | 20 ++++++++++++++++++++ 4 files changed, 44 insertions(+), 4 deletions(-) diff --git a/code/build/web/augmentation.cxx b/code/build/web/augmentation.cxx index 8be0a78..dae6f57 100644 --- a/code/build/web/augmentation.cxx +++ b/code/build/web/augmentation.cxx @@ -7,9 +7,12 @@ #include +#include + #include #include +#include #include namespace code::build::web @@ -17,8 +20,14 @@ namespace code::build::web augmentation_t:: augmentation_t() - : _diagnostics{std::cout} // fixme: make configurable - {} + { + _diagnostics.enable(seafire::server::server_category()); + _diagnostics.enable(seafire::server::supervisor_category()); + _diagnostics.enable(seafire::server::session_category()); + _diagnostics.enable(seafire::server::transaction_category()); + _diagnostics.enable(seafire::server::request_category()); + _diagnostics.enable(seafire::routing::routing_category()); + } void augmentation_t:: diff --git a/code/build/web/augmentation.hxx b/code/build/web/augmentation.hxx index ca64c34..4691e47 100644 --- a/code/build/web/augmentation.hxx +++ b/code/build/web/augmentation.hxx @@ -5,7 +5,7 @@ #include #include -#include +#include #include @@ -31,7 +31,7 @@ namespace code::build::web private: asio::io_context _io_context; - seafire::common::ostream_diagnostics_t _diagnostics; + seafire_diagnostics_t _diagnostics; }; diff --git a/code/build/web/diagnostics.cxx b/code/build/web/diagnostics.cxx index 3508386..7af3d01 100644 --- a/code/build/web/diagnostics.cxx +++ b/code/build/web/diagnostics.cxx @@ -17,4 +17,15 @@ namespace code::build::web return category; } + seafire_diagnostics_t:: + seafire_diagnostics_t() + {} + + void + seafire_diagnostics_t:: + do_log(std::string const& text) + { + record(http_category(), info()) << text; + } + } // namespace code::build::web diff --git a/code/build/web/diagnostics.hxx b/code/build/web/diagnostics.hxx index ca340e3..e029719 100644 --- a/code/build/web/diagnostics.hxx +++ b/code/build/web/diagnostics.hxx @@ -4,6 +4,8 @@ #include #include +#include + namespace code::build::web { @@ -13,6 +15,24 @@ namespace code::build::web category_t const& web_category(); + class seafire_diagnostics_t + : public code::seafire::common::diagnostics_t + { + public: + seafire_diagnostics_t(); + + seafire_diagnostics_t(seafire_diagnostics_t const&) = delete; + seafire_diagnostics_t(seafire_diagnostics_t&&) = delete; + + seafire_diagnostics_t& operator=(seafire_diagnostics_t const&) = delete; + seafire_diagnostics_t& operator=(seafire_diagnostics_t&&) = delete; + + protected: + void + do_log(string const&) override; + + }; + } // namespace code::build::web #endif