From e657640409f3bce55b24fd45bade09c902f12750 Mon Sep 17 00:00:00 2001 From: apio Date: Fri, 4 Nov 2022 20:21:57 +0100 Subject: [PATCH] Log timestamp of a request --- src/Request.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Request.cpp b/src/Request.cpp index 0aaa7fe..f0a46c6 100644 --- a/src/Request.cpp +++ b/src/Request.cpp @@ -145,7 +145,8 @@ static std::string method_to_string(webcxx::RequestType method) { } void webcxx::Request::log(int status_code) { - printf("%s - \"%s %s HTTP/1.1\" - %d\n", m_ip.c_str(), + time_t current_time = time(NULL); + printf("(%s) %s - \"%s %s HTTP/1.1\" - %d\n", ctime(¤t_time), m_ip.c_str(), method_to_string(m_method).c_str(), m_real_path.c_str(), status_code);