From b43e174baff49e3a3d40685527941448e2889c19 Mon Sep 17 00:00:00 2001 From: ejurgensen Date: Wed, 19 Feb 2020 22:57:24 +0100 Subject: [PATCH] [logger] Show long log messages truncated --- src/logger.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/logger.c b/src/logger.c index b7b43568..1b36cfcb 100644 --- a/src/logger.c +++ b/src/logger.c @@ -121,8 +121,10 @@ vlogger_writer(int severity, int domain, const char *fmt, va_list args) va_copy(ap, args); ret = vsnprintf(content, sizeof(content), fmt, ap); - if (ret < 0 || ret >= sizeof(content)) - strcpy(content, "(LOGGING SKIPPED - invalid content)\n"); + if (ret < 0) + strcpy(content, "(LOGGING SKIPPED - error printing log message)\n"); + else if (ret >= sizeof(content)) + strcpy(content + sizeof(content) - 8, "...\n"); va_end(ap); ret = repeat_count(content);