//
// Log handler
//
-// by James L. Hammons
+// by James Hammons
// (C) 2006 Underground Software
//
-// JLH = James L. Hammons <jlhamm@acm.org>
+// JLH = James Hammons <jlhamm@acm.org>
//
// WHO WHEN WHAT
// --- ---------- ------------------------------------------------------------
static FILE * log_stream = NULL;
static uint32_t logSize = 0;
-static bool logDone = false;
bool InitLog(const char * path)
//
void WriteLog(const char * text, ...)
{
- if (!log_stream || logDone)
+ if (!log_stream)
return;
va_list arg;
va_start(arg, text);
logSize += vfprintf(log_stream, text, arg);
+ va_end(arg);
+
+ fflush(log_stream); // Make sure that text is written!
if (logSize > MAX_LOG_SIZE)
{
- fflush(log_stream);
fclose(log_stream);
- logDone = true;
+ log_stream = NULL;
}
-
- va_end(arg);
- fflush(log_stream); // Make sure that text is written!
}