From 8323c2b2d6e7cbcc6ccc7f4c2eb4b3ff37c8c8c5 Mon Sep 17 00:00:00 2001 From: rubin Date: Fri, 22 May 2026 16:26:30 +0200 Subject: prepend time with aura_printf Signed-off-by: rubin --- logging.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/logging.h b/logging.h index 6ad5729..0e676dd 100644 --- a/logging.h +++ b/logging.h @@ -1,12 +1,20 @@ #include #include +#include static void aura_printf(const char *fmt, ...) { + char timestr[20] = { 0 }; va_list args = { 0 }; + struct tm *m = { 0 }; + time_t stamp = 0; - printf("[%d] ", getpid()); + stamp = time(NULL); + m = localtime(&stamp); + strftime((char *)×tr, 20, "%G-%m-%d %H:%M:%S", m); + + printf("{%s} [%d] ", (char *)×tr, getpid()); va_start(args, fmt); vprintf(fmt, args); va_end(args); -- cgit 1.4.1