From: wessels <> Date: Thu, 12 Sep 1996 04:39:23 +0000 (+0000) Subject: New cache.log timestamp X-Git-Tag: SQUID_3_0_PRE1~5838 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=396c5745e5ff7c81a169ecb8f8d38081bc6c25e7;p=thirdparty%2Fsquid.git New cache.log timestamp --- diff --git a/src/debug.cc b/src/debug.cc index 5a073bf52b..eaed6a9cb6 100644 --- a/src/debug.cc +++ b/src/debug.cc @@ -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); } diff --git a/src/tools.cc b/src/tools.cc index e1165a9d16..adc8389665 100644 --- a/src/tools.cc +++ b/src/tools.cc @@ -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; +}