/*
- * $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
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];
#endif
LOCAL_ARRAY(char, f, BUFSIZ);
LOCAL_ARRAY(char, tmpbuf, BUFSIZ);
- char *s = NULL;
if (debug_log == NULL)
return;
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 */
vfprintf(debug_log, f, args);
if (unbuffered_logs)
fflush(debug_log);
-
va_end(args);
}
/*
- * $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
(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;
+}