mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2024-11-11 01:55:38 +08:00
simplify PrintAndLogEx()
This commit is contained in:
parent
5ea8b4348c
commit
68fddf00ce
2 changed files with 7 additions and 11 deletions
14
client/ui.c
14
client/ui.c
|
@ -22,21 +22,17 @@ bool showDemod = true;
|
|||
pthread_mutex_t print_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
static char *logfilename = "proxmark3.log";
|
||||
|
||||
void PrintAndLogEx(logLevel_t level, char *filename, int lineno, char *func, char *fmt, ...) {
|
||||
void PrintAndLogEx(logLevel_t level, char *fmt, ...) {
|
||||
char buffer[MAX_PRINT_BUFFER] = {0};
|
||||
int size;
|
||||
static char *prefix[5];
|
||||
prefix[0]="";
|
||||
prefix[1]=" [+] ";
|
||||
prefix[2]=" [!] ";
|
||||
prefix[3]=" [!!] ";
|
||||
prefix[4]=" [#] ";
|
||||
static char *prefix[7] = { "", "[+] ", "[=] ", "[-] ", "[!] ", "[!!] ", "[#] "};
|
||||
|
||||
size=strlen(prefix[level]);
|
||||
strncpy(buffer, prefix[level], MAX_PRINT_BUFFER);
|
||||
strncpy(buffer, prefix[level], sizeof buffer);
|
||||
|
||||
va_list args;
|
||||
va_start(args,fmt);
|
||||
vsprintf(buffer + size,fmt, args);
|
||||
vsnprintf(buffer + size, sizeof(buffer) - size, fmt, args);
|
||||
va_end(args);
|
||||
PrintAndLog(buffer);
|
||||
}
|
||||
|
|
|
@ -29,14 +29,14 @@
|
|||
#define M_PI 3.14159265358979323846264338327
|
||||
#endif
|
||||
#define MAX_PRINT_BUFFER 2048
|
||||
typedef enum logLevel {NORMAL, INFO, WARNING, ERR, DEBUG} logLevel_t;
|
||||
typedef enum logLevel {NORMAL, SUCCESS, INFO, FAILED, WARNING, ERR, DEBUG} logLevel_t;
|
||||
|
||||
void ShowGui(void);
|
||||
void HideGraphWindow(void);
|
||||
void ShowGraphWindow(void);
|
||||
void RepaintGraphWindow(void);
|
||||
extern void PrintAndLog(char *fmt, ...);
|
||||
void PrintAndLogEx(logLevel_t level, char *filename, int lineno, char *func, char *fmt, ...);
|
||||
void PrintAndLogEx(logLevel_t level, char *fmt, ...);
|
||||
extern void SetLogFilename(char *fn);
|
||||
|
||||
extern double CursorScaleFactor;
|
||||
|
|
Loading…
Reference in a new issue