From 36ee645b620751b6075e204c47d9bb1d8b81bb3d Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Thu, 31 Aug 2023 08:38:53 +1000 Subject: [PATCH] Suppress LOG timestamps when testing. The time stamps are less helpful when testing, and they make it hard to diff outputs between different runs. Signed-off-by: NeilBrown --- core-log.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/core-log.c b/core-log.c index 0a4464fa..681b12c3 100644 --- a/core-log.c +++ b/core-log.c @@ -86,8 +86,12 @@ void LOG(char *fmt, ...) gettimeofday(&now, NULL); b = get_buf(log_doc); va_start(ap, fmt); - n = snprintf(b->text + b->end, LBSIZE - b->end - 1, "%ld.%03ld:", - now.tv_sec % 10000, now.tv_usec / 1000); + if (log_pane && edlib_testing(log_pane)) + n = 0; + else + n = snprintf(b->text + b->end, LBSIZE - b->end - 1, + "%ld.%03ld:", + now.tv_sec % 10000, now.tv_usec / 1000); if (n < LBSIZE - b->end - 1) n += vsnprintf(b->text + b->end + n, LBSIZE - b->end - 1 - n, fmt, ap); @@ -97,8 +101,12 @@ void LOG(char *fmt, ...) /* Didn't fit, allocate new buf */ b = get_new_buf(log_doc); va_start(ap, fmt); - n = snprintf(b->text, LBSIZE - 1, "%ld.%03ld:", - now.tv_sec % 10000, now.tv_usec / 1000); + if (log_pane && edlib_testing(log_pane)) + n = 0; + else + n = snprintf(b->text, LBSIZE - 1, "%ld.%03ld:", + now.tv_sec % 10000, + now.tv_usec / 1000); if (n < LBSIZE - 1) n += vsnprintf(b->text + n, LBSIZE - 1 - n, fmt, ap); va_end(ap); -- 2.39.5