5 // (C) 2006 Underground Software
7 // JLH = James Hammons <jlhamm@acm.org>
10 // --- ---------- -----------------------------------------------------------
11 // JLH 01/03/2006 Moved includes out of header file for faster compilation
21 // Maximum size of log file (10 MB ought to be enough for anybody)
22 #define MAX_LOG_SIZE 10000000
24 static FILE * log_stream = NULL;
25 static uint32_t logSize = 0;
28 bool InitLog(const char * path)
30 log_stream = fopen(path, "w");
32 if (log_stream == NULL)
47 // This logger is used mainly to ensure that text gets written to the log file
48 // even if the program crashes. The performance hit is acceptable in this case!
50 void WriteLog(const char * text, ...)
58 logSize += vfprintf(log_stream, text, arg);
61 fflush(log_stream); // Make sure that text is written!
63 if (logSize > MAX_LOG_SIZE)