From fcad4054b6e5778d898430df930873aab11480aa Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Wed, 25 Apr 2018 09:28:27 +0200 Subject: [PATCH] CHG: PrintAndLogEx, prints prefixes on without the \n in string --- client/ui.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/client/ui.c b/client/ui.c index 708e473d7..f7977c0ed 100644 --- a/client/ui.c +++ b/client/ui.c @@ -80,8 +80,14 @@ void PrintAndLogEx(logLevel_t level, char *fmt, ...) { vsnprintf(buffer, sizeof(buffer), fmt, args); va_end(args); + // no prefixes for normal + if ( level == NORMAL ) { + PrintAndLog(buffer); + return; + } + if (strchr(buffer, '\n')) { - + token = strtok(buffer, "\n"); while (token != NULL) { @@ -94,9 +100,10 @@ void PrintAndLogEx(logLevel_t level, char *fmt, ...) { token = strtok(NULL, "\n"); } PrintAndLog(buffer2); + } else { + snprintf(buffer2, sizeof(buffer2), "%s%s", prefix, buffer); + PrintAndLog(buffer2); } - else - PrintAndLog(buffer); } void PrintAndLog(char *fmt, ...) {