mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-22 06:13:51 -07:00
Merge pull request #177 from brianpow/PrintAndLogEx
add PrintAndLogEx()
This commit is contained in:
commit
4efb9aba4d
2 changed files with 19 additions and 0 deletions
15
client/ui.c
15
client/ui.c
|
@ -22,6 +22,21 @@ bool showDemod = true;
|
||||||
pthread_mutex_t print_lock = PTHREAD_MUTEX_INITIALIZER;
|
pthread_mutex_t print_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||||
static char *logfilename = "proxmark3.log";
|
static char *logfilename = "proxmark3.log";
|
||||||
|
|
||||||
|
void PrintAndLogEx(logLevel_t level, char *fmt, ...) {
|
||||||
|
char buffer[MAX_PRINT_BUFFER] = {0};
|
||||||
|
int size;
|
||||||
|
static char *prefix[7] = { "", "[+] ", "[=] ", "[-] ", "[!] ", "[!!] ", "[#] "};
|
||||||
|
|
||||||
|
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);
|
||||||
|
va_end(args);
|
||||||
|
PrintAndLog(buffer);
|
||||||
|
}
|
||||||
|
|
||||||
void PrintAndLog(char *fmt, ...) {
|
void PrintAndLog(char *fmt, ...) {
|
||||||
char *saved_line;
|
char *saved_line;
|
||||||
int saved_point;
|
int saved_point;
|
||||||
|
|
|
@ -28,11 +28,15 @@
|
||||||
#ifndef M_PI
|
#ifndef M_PI
|
||||||
#define M_PI 3.14159265358979323846264338327
|
#define M_PI 3.14159265358979323846264338327
|
||||||
#endif
|
#endif
|
||||||
|
#define MAX_PRINT_BUFFER 2048
|
||||||
|
typedef enum logLevel {NORMAL, SUCCESS, INFO, FAILED, WARNING, ERR, DEBUG} logLevel_t;
|
||||||
|
|
||||||
void ShowGui(void);
|
void ShowGui(void);
|
||||||
void HideGraphWindow(void);
|
void HideGraphWindow(void);
|
||||||
void ShowGraphWindow(void);
|
void ShowGraphWindow(void);
|
||||||
void RepaintGraphWindow(void);
|
void RepaintGraphWindow(void);
|
||||||
extern void PrintAndLog(char *fmt, ...);
|
extern void PrintAndLog(char *fmt, ...);
|
||||||
|
void PrintAndLogEx(logLevel_t level, char *fmt, ...);
|
||||||
extern void SetLogFilename(char *fn);
|
extern void SetLogFilename(char *fn);
|
||||||
|
|
||||||
extern double CursorScaleFactor;
|
extern double CursorScaleFactor;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue