Michael Thomas 75390c7
--- common/logger.c.orig	2007-02-23 15:48:18.000000000 -0800
Michael Thomas 75390c7
+++ common/logger.c	2007-02-23 21:28:46.000000000 -0800
Michael Thomas 75390c7
@@ -30,6 +30,7 @@
Michael Thomas 75390c7
 #include <stdarg.h>
Michael Thomas 75390c7
 #include <global.h>
Michael Thomas 75390c7
 #include <funcpoint.h>
Michael Thomas 75390c7
+#include <time.h>
Michael Thomas 75390c7
 
Michael Thomas 75390c7
 /*
Michael Thomas 75390c7
  * Logs a message to stderr, or to file, and/or even to socket.
Michael Thomas 75390c7
@@ -49,6 +50,18 @@
Michael Thomas 75390c7
 		     * than any other buffer, since that buffer may
Michael Thomas 75390c7
 		     * need to be put in this one.
Michael Thomas 75390c7
 		     */
Michael Thomas 75390c7
+  char time_buf[2048];
Michael Thomas 75390c7
+  time_t now = time((time_t *)NULL);
Michael Thomas 75390c7
+  struct tm *time_tmp;
Michael Thomas 75390c7
+
Michael Thomas 75390c7
+  now = time(NULL);
Michael Thomas 75390c7
+  time_tmp = localtime(&now;;
Michael Thomas 75390c7
+  if (time_tmp == NULL) {
Michael Thomas 75390c7
+      perror("localtime");
Michael Thomas 75390c7
+  }
Michael Thomas 75390c7
+  if (strftime(time_buf, sizeof(time_buf), "%m/%d/%y %H:%M:%S", time_tmp) == 0) {
Michael Thomas 75390c7
+      fprintf(stderr, "strftime returned 0");
Michael Thomas 75390c7
+  }
Michael Thomas 75390c7
 
Michael Thomas 75390c7
   va_list ap;
Michael Thomas 75390c7
   va_start(ap, format);
Michael Thomas 75390c7
@@ -68,8 +81,11 @@
Michael Thomas 75390c7
     fputs(buf, stderr); 
Michael Thomas 75390c7
   }
Michael Thomas 75390c7
 #else
Michael Thomas 75390c7
+    fputs(time_buf, logfile);
Michael Thomas 75390c7
+    fputs(" ", logfile);
Michael Thomas 75390c7
     fputs(loglevel_names[logLevel], logfile);
Michael Thomas 75390c7
     fputs(buf, logfile);
Michael Thomas 75390c7
+    fflush(logfile);
Michael Thomas 75390c7
 #endif
Michael Thomas 75390c7
   }
Michael Thomas 75390c7
   if (!exiting && !trying_emergency_save &&