From 69aa3bfeede4c93e70bfcff64131640d41f7c736 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Wed, 21 Feb 2018 14:42:00 +0100 Subject: [PATCH] chg: skip printing DEBUG messages if global client debug variable it set to zero. --- client/ui.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/client/ui.c b/client/ui.c index 31529a63f..216967e90 100644 --- a/client/ui.c +++ b/client/ui.c @@ -27,9 +27,14 @@ void PrintAndLogEx(logLevel_t level, char *fmt, ...) { int size; static char *prefix[7] = { "", "[+] ", "[=] ", "[-] ", "[!] ", "[!!] ", "[#] "}; - size=strlen(prefix[level]); - strncpy(buffer, prefix[level], sizeof buffer); - + if (g_debugMode == 0 && level == logLevel.DEBUG) { + // skip debug messages if client debugging is turned off i.e. 'DATA SETDEBUG 0' + } + else { + size = strlen(prefix[level]); + strncpy(buffer, prefix[level], sizeof buffer); + } + va_list args; va_start(args,fmt); vsnprintf(buffer + size, sizeof(buffer) - size, fmt, args);