10 #define MAX_LOG_SIZE 10000000 // Maximum size of log file (10 MB)
12 static FILE * log_stream = NULL;
13 static uint32 logSize = 0;
15 bool InitLog(const char * path)
17 log_stream = fopen(path, "wrt");
19 if (log_stream == NULL)
32 // This logger is used mainly to ensure that text gets written to the log file
33 // even if the program crashes. The performance hit is acceptable in this case!
35 void WriteLog(const char * text, ...)
43 logSize += vfprintf(log_stream, text, arg);
45 if (logSize > MAX_LOG_SIZE)
53 fflush(log_stream); // Make sure that text is written!