Enable Seafire diagnostics

This commit is contained in:
G.H.O.S.T 2024-12-31 00:55:43 +01:00
parent 6673e3936b
commit 4216469674
Signed by: G.H.O.S.T
GPG Key ID: 3BD93EABD1407B82
4 changed files with 44 additions and 4 deletions

View File

@ -7,9 +7,12 @@
#include <code/build/web/http-server.hxx> #include <code/build/web/http-server.hxx>
#include <code/seafire/server/diagnostics.hxx>
#include <code/seafire/protocol/rfc7231/server.hxx> #include <code/seafire/protocol/rfc7231/server.hxx>
#include <code/seafire/common/io/tcp-acceptor.hxx> #include <code/seafire/common/io/tcp-acceptor.hxx>
#include <code/seafire/routing/diagnostics.hxx>
#include <code/seafire/routing/router.hxx> #include <code/seafire/routing/router.hxx>
namespace code::build::web namespace code::build::web
@ -17,8 +20,14 @@ namespace code::build::web
augmentation_t:: augmentation_t::
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 void
augmentation_t:: augmentation_t::

View File

@ -5,7 +5,7 @@
#include <code/build/initialization-context.hxx> #include <code/build/initialization-context.hxx>
#include <code/build/types.hxx> #include <code/build/types.hxx>
#include <code/seafire/common/diagnostics.hxx> #include <code/build/web/diagnostics.hxx>
#include <asio.hpp> #include <asio.hpp>
@ -31,7 +31,7 @@ namespace code::build::web
private: private:
asio::io_context _io_context; asio::io_context _io_context;
seafire::common::ostream_diagnostics_t _diagnostics; seafire_diagnostics_t _diagnostics;
}; };

View File

@ -17,4 +17,15 @@ namespace code::build::web
return category; 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 } // namespace code::build::web

View File

@ -4,6 +4,8 @@
#include <code/build/types.hxx> #include <code/build/types.hxx>
#include <code/build/diagnostics.hxx> #include <code/build/diagnostics.hxx>
#include <code/seafire/common/diagnostics.hxx>
namespace code::build::web namespace code::build::web
{ {
@ -13,6 +15,24 @@ namespace code::build::web
category_t const& category_t const&
web_category(); 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 } // namespace code::build::web
#endif #endif