]> Shamusworld >> Repos - thunder/blobdiff - src/log.cpp
Code cleanup.
[thunder] / src / log.cpp
old mode 100755 (executable)
new mode 100644 (file)
index 236d563..623a6b9
@@ -1,54 +1,65 @@
 //
 // Log handler
 //
-// by James L. Hammons
+// by James Hammons
+// (C) 2004, 2014 Underground Software
+//
+// JLH = James Hammons <jlhamm@acm.org>
+//
+// WHO  WHEN        WHAT
+// ---  ----------  -----------------------------------------------------------
+// JLH  07/23/2009  Added changelog ;-)
 //
 
 #include "types.h"
 #include "log.h"
 
-#define MAX_LOG_SIZE           10000000                                // Maximum size of log file (10 MB)
+#define MAX_LOG_SIZE           10000000                // Maximum size of log file (10 MB)
 
-static FILE * log_stream = NULL;
+static FILE * logStream = NULL;
 static uint32 logSize = 0;
 
-bool InitLog(char * path)
+
+bool InitLog(const char * path)
 {
-       log_stream = fopen(path, "wrt");
+       logStream = fopen(path, "wrt");
 
-       if (log_stream == NULL)
+       if (logStream == NULL)
                return false;
 
        return true;
 }
 
+
 void LogDone(void)
 {
-       if (log_stream)
-               fclose(log_stream);
+       if (logStream)
+               fclose(logStream);
 }
 
+
 //
 // This logger is used mainly to ensure that text gets written to the log file
 // even if the program crashes. The performance hit is acceptable in this case!
 //
 void WriteLog(const char * text, ...)
 {
-       if (!log_stream)
+       if (!logStream)
                return;
 
        va_list arg;
 
        va_start(arg, text);
-       logSize += vfprintf(log_stream, text, arg);
+       logSize += vfprintf(logStream, text, arg);
 
        if (logSize > MAX_LOG_SIZE)
        {
-               fflush(log_stream);
-               fclose(log_stream);
+               fflush(logStream);
+               fclose(logStream);
                exit(1);
-       }//*/
+       }
 
        va_end(arg);
-       fflush(log_stream);                                     // Make sure that text is written!
+       fflush(logStream);                                      // Make sure that text is written!
 }
+