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_t logSize = 0;
22 bool InitLog(const char * path)
24 logStream = fopen(path, "wrt");
26 if (logStream == 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(logStream, text, arg);
52 if (logSize > MAX_LOG_SIZE)
60 fflush(logStream); // Make sure that text is written!