5 // (C) 2004, 2014 Underground Software
7 // JLH = James 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 * logStream = NULL;
20 static uint32 logSize = 0;
23 bool InitLog(const char * path)
25 logStream = fopen(path, "wrt");
27 if (logStream == NULL)
42 // This logger is used mainly to ensure that text gets written to the log file
43 // even if the program crashes. The performance hit is acceptable in this case!
45 void WriteLog(const char * text, ...)
53 logSize += vfprintf(logStream, text, arg);
55 if (logSize > MAX_LOG_SIZE)
63 fflush(logStream); // Make sure that text is written!