From 287b4af722b7ec089645cf9cd75233c6c90908cf Mon Sep 17 00:00:00 2001 From: arf20 Date: Mon, 20 Oct 2025 23:18:26 +0200 Subject: HTTP monitoring --- main.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index f01d928..15379b3 100644 --- a/main.c +++ b/main.c @@ -1,16 +1,18 @@ #include #include #include - #include #include -#include - #include #include #include #include +#include + +#include + + #include "monitor.h" @@ -35,7 +37,13 @@ enum MHD_Result answer_to_connection( (const struct sockaddr_in**)MHD_get_connection_info( connection, MHD_CONNECTION_INFO_CLIENT_ADDRESS); - printf("%s - %s %s: ", inet_ntoa((*coninfo)->sin_addr), method, url); + time_t time_now = time(NULL); + struct tm *tm_now = gmtime(&time_now); + static char timestr[256]; + strftime(timestr, 256, "%Y-%m-%d %H-%M-%S", tm_now); + + printf("[%s] [webserver] %s %s %s: ", + timestr, inet_ntoa((*coninfo)->sin_addr), method, url); struct MHD_Response *response; int ret; -- cgit v1.2.3