Commit 80e0082e04b0f3383d206df759f716864334ce67

Authored by henyxia
1 parent bc20374b

Some fixes, separated files

Showing 1 changed file with 4 additions and 3 deletions   Show diff stats
printx.c
... ... @@ -11,7 +11,7 @@
11 11 #define S_RESET "\33[0m"
12 12 #define MAX_BUFFER 128
13 13  
14   -FILE* logfile = NULL;
  14 +FILE* logfiles[5] = {NULL, NULL, NULL, NULL, NULL};
15 15 char s_color[4][12] = {"\x1b[01;31m", "\x1b[01;33m", "\x1b[01;32m", "\x1b[01;36m"};
16 16 char f_name[5][5] = {"MAIN", "UI ", "NFC ", "HVC ", "BUS "};
17 17 float start;
... ... @@ -60,9 +60,10 @@ void printx(severity s, msgfrom from, char* str, ...)
60 60 float now = clock();
61 61 va_start(arglist, str);
62 62 vsprintf(buffer1, str, arglist);
63   - fprintf(logfile, "[%6f] : %s", (now - start)/CLOCKS_PER_SEC, buffer1);
  63 + fprintf(logfile, "[%6.6f] : %s", (now - start)/CLOCKS_PER_SEC, buffer1);
64 64 fflush(logfile);
65 65 sprintf(buffer2, "[%s] %s%s%s", f_name[from], s_color[s], buffer1, S_RESET);
66   - printf("%s", buffer2);
  66 + if(s>DEBUG)
  67 + printf("%s", buffer2);
67 68 va_end(arglist);
68 69 }
... ...