]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
New cache.log timestamp
authorwessels <>
Thu, 12 Sep 1996 04:39:23 +0000 (04:39 +0000)
committerwessels <>
Thu, 12 Sep 1996 04:39:23 +0000 (04:39 +0000)
src/debug.cc
src/tools.cc

index 5a073bf52bcedaeb351d1dbc5c16fc1061cd79c6..eaed6a9cb6a87713527e0a97157aa35d028b30a9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: debug.cc,v 1.21 1996/08/19 22:44:51 wessels Exp $
+ * $Id: debug.cc,v 1.22 1996/09/11 22:39:24 wessels Exp $
  *
  * DEBUG: section 0     Debug Routines
  * AUTHOR: Harvest Derived
@@ -110,8 +110,6 @@ int _db_line = 0;
 
 FILE *debug_log = NULL;
 static char *debug_log_file = NULL;
-static time_t last_squid_curtime = 0;
-static char the_time[81];
 
 #define MAX_DEBUG_SECTIONS 50
 static int debugLevels[MAX_DEBUG_SECTIONS];
@@ -131,7 +129,6 @@ void _db_print(va_alist)
 #endif
     LOCAL_ARRAY(char, f, BUFSIZ);
     LOCAL_ARRAY(char, tmpbuf, BUFSIZ);
-    char *s = NULL;
 
     if (debug_log == NULL)
        return;
@@ -149,18 +146,17 @@ void _db_print(va_alist)
        va_end(args);
        return;
     }
-    /* don't compute the curtime too much */
-    if (last_squid_curtime != squid_curtime) {
-       last_squid_curtime = squid_curtime;
-       the_time[0] = '\0';
-       s = mkhttpdlogtime(&squid_curtime);
-       strcpy(the_time, s);
-    }
-    sprintf(f, "[%s] %s:%d:\t %s",
-       the_time,
+#ifdef LOG_FILE_AND_LINE
+    sprintf(f, "%s %-10.10s %4d| %s",
+       accessLogTime(squid_curtime),
        _db_file,
        _db_line,
        format);
+#else
+    sprintf(f, "%s| %s",
+       accessLogTime(squid_curtime),
+       format);
+#endif
 
 #if HAVE_SYSLOG
     /* level 0 go to syslog */
@@ -175,7 +171,6 @@ void _db_print(va_alist)
     vfprintf(debug_log, f, args);
     if (unbuffered_logs)
        fflush(debug_log);
-
     va_end(args);
 }
 
index e1165a9d168a96c6ce380f51edd0d716f41e76d5..adc8389665991ee8157c20959712f80fc192d224 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: tools.cc,v 1.51 1996/08/30 23:23:36 wessels Exp $
+ * $Id: tools.cc,v 1.52 1996/09/11 22:39:23 wessels Exp $
  *
  * DEBUG: section 21    Misc Functions
  * AUTHOR: Harvest Derived
@@ -566,3 +566,17 @@ void squid_signal(sig, func, flags)
     (void) signal(sig, func);
 #endif
 }
+
+char *accessLogTime(t)
+       time_t t;
+{
+        struct tm *tm;
+       static char buf[128];
+       static char last_t = 0;
+       if (t != last_t) {
+               tm = localtime(&t);
+               strftime (buf, 127, "%y/%m/%d %T", tm);
+               last_t = t;
+       }
+       return buf;
+}