5 // (c) 2004, 2009 Underground Software
7 // JLH = James L. Hammons <jlhamm@acm.org>
10 // --- ---------- ------------------------------------------------------------
11 // JLH 07/23/2009 Added changelog ;-)
17 #define MAX_LOG_SIZE 10000000 // Maximum size of log file (10 MB)
19 static FILE * log_stream = NULL;
20 static uint32 logSize = 0;
22 bool InitLog(const char * path)
24 log_stream = fopen(path, "wrt");
26 if (log_stream == NULL)
39 // This logger is used mainly to ensure that text gets written to the log file
40 // even if the program crashes. The performance hit is acceptable in this case!
42 void WriteLog(const char * text, ...)
50 logSize += vfprintf(log_stream, text, arg);
52 if (logSize > MAX_LOG_SIZE)
60 fflush(log_stream); // Make sure that text is written!