Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


IDE/ATA enhancements and bug-fixing: DMA operation
[palacios.git] / misc / network_servers / vtl / debug.cc
1 #include "debug.h"
2 #include <time.h>
3 #include <stdio.h>
4 #include <stdarg.h>
5
6 static FILE * logfile = NULL;
7 static int debug_on = 0;
8
9 int vtl_debug_init(string logfilename, int debug_enable) {
10     debug_on = debug_enable; 
11     logfile = fopen(logfilename.c_str(), "w+");
12     return 0;
13 }
14
15
16
17 void vtl_debug(const char * fmt, ...) {
18     if (debug_on) {
19         va_list args;
20         time_t dbgt;
21         struct tm * time_data;
22         char time_str[200];
23
24         time(&dbgt); 
25         time_data = localtime(&dbgt);
26
27
28         strftime(time_str, sizeof(time_str), "%a %b %d %r %Y : ", time_data);
29
30         fprintf(logfile, "%s", time_str); 
31
32         va_start(args, fmt);
33         vfprintf(logfile, fmt, args);
34         va_end(args);
35
36         fflush(logfile);
37     }
38 }