From 639812d4357182c7790f495787ccded69159b88b Mon Sep 17 00:00:00 2001 From: uink45 <79078981+uink45@users.noreply.github.com> Date: Wed, 17 Dec 2025 22:44:46 +1000 Subject: [PATCH] Include date in the logging timestamp; --- Dockerfile | 4 ++-- src/support/log.c | 11 +++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index fd30b56..1d5355f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -84,7 +84,7 @@ FROM ubuntu:22.04 ENV DEBIAN_FRONTEND=noninteractive -# Set to "true" to include gdb and perf for debugging/profiling +# Set to "true" to include gdb, perf, and valgrind for debugging/profiling ARG INCLUDE_DEBUG_TOOLS=false # Install runtime dependencies (and optionally profiling tools) @@ -94,7 +94,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ libstdc++6 \ zlib1g \ && if [ "$INCLUDE_DEBUG_TOOLS" = "true" ]; then \ - apt-get install -y --no-install-recommends gdb linux-tools-generic \ + apt-get install -y --no-install-recommends gdb linux-tools-generic valgrind \ && ln -sf /usr/lib/linux-tools/*/perf /usr/local/bin/perf || true; \ fi \ && rm -rf /var/lib/apt/lists/* diff --git a/src/support/log.c b/src/support/log.c index 5a644f4..d5688bc 100644 --- a/src/support/log.c +++ b/src/support/log.c @@ -226,9 +226,12 @@ static void format_timestamp(char buffer[32]) { buffer[0] = '\0'; return; } - /* Clean format: HH:MM:SS.mmm */ + /* Clean format: YYYY-MM-DD HH:MM:SS.mmm */ int written = snprintf( - buffer, 32, "%02d:%02d:%02d.%03ld", + buffer, 32, "%04d-%02d-%02d %02d:%02d:%02d.%03ld", + tm_result.tm_year + 1900, + tm_result.tm_mon + 1, + tm_result.tm_mday, tm_result.tm_hour, tm_result.tm_min, tm_result.tm_sec, @@ -339,7 +342,7 @@ void lantern_log_log( fprintf( target, "%s%s%s %s%s%s %s[%s]%s %s", - ANSI_DIM, timestamp[0] ? timestamp : "??:??:??.???", ANSI_RESET, + ANSI_DIM, timestamp[0] ? timestamp : "????-??-?? ??:??:??.???", ANSI_RESET, level_to_color(level), level_to_string(level), ANSI_RESET, ANSI_CYAN, component ? component : "?", ANSI_RESET, formatted); @@ -354,7 +357,7 @@ void lantern_log_log( fprintf( target, "%s %s [%s] %s", - timestamp[0] ? timestamp : "??:??:??.???", + timestamp[0] ? timestamp : "????-??-?? ??:??:??.???", level_to_string(level), component ? component : "?", formatted);