polished up event loop changes
Some checks failed
Docker Build & Publish / build (push) Failing after 55m49s

This commit is contained in:
Nicholas Orlowsky 2025-02-21 18:24:28 -05:00
parent 058c395095
commit 409024e04a
18 changed files with 354 additions and 428 deletions

View file

@ -10,6 +10,11 @@ void Logger::initialize(enum LOG_LEVEL level)
_level = level;
}
void Logger::log_request_and_response(http::request& req, std::unique_ptr<http::response>& resp, uint32_t micros)
{
log::info << "[" << resp->status_code() << " " + http::status_map.find(resp->status_code())->second + "] " + req.client_ip() + " " + http::reverse_method_map.find(req.get_method())->second + " " + req.path() << " in " << micros << " usecs" << std::endl;
}
LogBuf::LogBuf(std::ostream& output_stream, const std::string& tag, enum LOG_LEVEL level)
: _output_stream(output_stream)
, _tag(tag)

View file

@ -3,6 +3,10 @@
#include <iostream>
#include <ostream>
#include <sstream>
#include <inttypes.h>
#include <memory>
#include "../http/request.hpp"
#include "../http/response.hpp"
namespace anthracite::log {
enum LOG_LEVEL {
@ -21,9 +25,9 @@ namespace anthracite::log {
Logger();
void initialize(enum LOG_LEVEL level);
void log_request_and_response(http::request& req, std::unique_ptr<http::response>& resp, uint32_t micros);
};
class LogBuf : public std::stringbuf
{
std::string _tag;
@ -50,4 +54,6 @@ namespace anthracite::log {
static class LogBuf debugBuf{std::cout, "DEBG", LOG_LEVEL_DEBUG};
static std::ostream debug(&debugBuf);
};