mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2024-12-31 04:39:49 +08:00
chg: skip printing debug statements when not debugging.
chg: started with a coloring of messages. Didn't work super well..
This commit is contained in:
parent
a9c652bb6c
commit
d8281e69fd
2 changed files with 24 additions and 7 deletions
|
@ -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;
|
||||
|
|
25
client/ui.c
25
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 {
|
||||
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;
|
||||
|
|
Loading…
Reference in a new issue