From: NeilBrown Date: Wed, 30 Aug 2023 22:38:53 +0000 (+1000) Subject: Suppress LOG timestamps when testing. X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=36ee645b620751b6075e204c47d9bb1d8b81bb3d;p=edlib.git 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 --- 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);