AmendHub

Download:

jcs

/

subtext

/

amendments

/

304

logger: If we have to truncate a message, indicate that


jcs made amendment 304 about 1 year ago
--- logger.c Sun Feb 5 10:32:56 2023 +++ logger.c Wed Feb 22 15:20:34 2023 @@ -319,8 +319,12 @@ logger_vprintf(const char *format, va_list ap) len = strftime(buf, sizeof(buf), "\r[%H:%M:%S] ", localtime(&now)); len += vsnprintf(buf + len, sizeof(buf) - len, format, ap); - if (len > sizeof(buf)) + if (len > sizeof(buf)) { + buf[sizeof(buf) - 1] = ']'; + buf[sizeof(buf) - 2] = '…'; + buf[sizeof(buf) - 3] = '['; len = sizeof(buf); + } while (buf[len - 1] == '\r') { buf[len - 1] = '\0';