]>
Commit | Line | Data |
---|---|---|
6658905f | 1 | #include <stdarg.h> |
2 | #include <stdio.h> | |
3 | #include <time.h> | |
4 | ||
5 | #include "proxgui.h" | |
6 | #include "translate.h" | |
7 | #include "../winsrc/prox.h" | |
8 | ||
9 | int GraphBuffer[MAX_GRAPH_TRACE_LEN]; | |
10 | int GraphTraceLen; | |
11 | double CursorScaleFactor; | |
12 | int CommandFinished; | |
d722c4ce | 13 | int offline; |
6658905f | 14 | |
15 | static char *logfilename = "proxmark3.log"; | |
16 | ||
17 | void PrintToScrollback(char *fmt, ...) { | |
18 | va_list argptr; | |
19 | static FILE *logfile = NULL; | |
20 | static int logging=1; | |
21 | ||
22 | if (logging && !logfile) { | |
23 | logfile=fopen(logfilename, "a"); | |
24 | if (!logfile) { | |
25 | fprintf(stderr, "Can't open logfile, logging disabled!\n"); | |
26 | logging=0; | |
27 | } | |
28 | } | |
29 | ||
30 | va_start(argptr, fmt); | |
31 | vprintf(fmt, argptr); | |
32 | printf("\n"); | |
33 | if (logging && logfile) { | |
34 | #if 0 | |
35 | char zeit[25]; | |
36 | time_t jetzt_t; | |
37 | struct tm *jetzt; | |
38 | ||
39 | jetzt_t = time(NULL); | |
40 | jetzt = localtime(&jetzt_t); | |
41 | strftime(zeit, 25, "%b %e %T", jetzt); | |
42 | ||
43 | fprintf(logfile,"%s ", zeit); | |
44 | #endif | |
45 | vfprintf(logfile, fmt, argptr); | |
46 | fprintf(logfile,"\n"); | |
47 | fflush(logfile); | |
48 | } | |
49 | va_end(argptr); | |
50 | } | |
51 | ||
52 | void setlogfilename(char *fn) | |
53 | { | |
54 | logfilename = fn; | |
55 | } |