diff --git a/client/cmddata.c b/client/cmddata.c index 21bc334e8..16a1c9f10 100644 --- a/client/cmddata.c +++ b/client/cmddata.c @@ -1283,7 +1283,7 @@ int CmdRawDemod(const char *Cmd) void setClockGrid(int clk, int offset) { g_DemodStartIdx = offset; g_DemodClock = clk; - PrintAndLogEx(DEBUG, "DBEUG: (setClockGrid) demodoffset %d, clk %d",offset,clk); + PrintAndLogEx(DEBUG, "DEBUG: (setClockGrid) demodoffset %d, clk %d", offset, clk); if (offset > clk) offset %= clk; if (offset < 0) offset += clk; diff --git a/client/ui.c b/client/ui.c index d5d808a22..0d176862c 100644 --- a/client/ui.c +++ b/client/ui.c @@ -23,16 +23,33 @@ pthread_mutex_t print_lock = PTHREAD_MUTEX_INITIALIZER; static char *logfilename = "proxmark3.log"; void PrintAndLogEx(logLevel_t level, char *fmt, ...) { + + // skip debug messages if client debugging is turned off i.e. 'DATA SETDEBUG 0' + if (g_debugMode == 0 && level == DEBUG) + return; + char buffer[MAX_PRINT_BUFFER] = {0}; int size = 0; + // {NORMAL, SUCCESS, INFO, FAILED, WARNING, ERR, DEBUG} static char *prefix[7] = { "", "[+] ", "[=] ", "[-] ", "[!] ", "[!!] ", "[#] "}; - if (g_debugMode == 0 && level == 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); + switch( level ) { + case FAILED: + size = strlen( _RED_([-] ) ); + strncpy(buffer,_RED_([-] ), size); + break; + case DEBUG: + size = strlen( _BLUE_([#] ) ); + strncpy(buffer,_BLUE_([#] ), size); + break; + case SUCCESS: + size = strlen( _GREEN_([+] ) ); + strncpy(buffer,_GREEN_([+] ), size); + break; + default: + size = strlen(prefix[level]); + strncpy(buffer, prefix[level], sizeof buffer); + break; } va_list args;