5 // (C) 2006 Underground Software
7 // JLH = James L. Hammons <jlhamm@acm.org>
10 // --- ---------- ------------------------------------------------------------
11 // JLH 01/03/2006 Moved includes out of header file for faster compilation
21 #define MAX_LOG_SIZE 10000000 // Maximum size of log file (10 MB)
23 static FILE * log_stream = NULL;
24 static uint32 logSize = 0;
26 bool InitLog(char * path)
28 log_stream = fopen(path, "wrt");
30 if (log_stream == NULL)
43 // This logger is used mainly to ensure that text gets written to the log file
44 // even if the program crashes. The performance hit is acceptable in this case!
46 void WriteLog(const char * text, ...)
54 logSize += vfprintf(log_stream, text, arg);
56 if (logSize > MAX_LOG_SIZE)
64 fflush(log_stream); // Make sure that text is written!