From 6ddd1683b5c679582b751eaaefad089a7efe1c83 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Fri, 6 Feb 2009 12:38:29 +0000 Subject: introduce new "DEBUGPC" macro for continuing on the same line without prefix of file/line/time --- src/debug.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src/debug.c') diff --git a/src/debug.c b/src/debug.c index 5504e112b..a3084e265 100644 --- a/src/debug.c +++ b/src/debug.c @@ -98,11 +98,9 @@ const char* color(int subsys) return ""; } -void debugp(unsigned int subsys, char *file, int line, const char *format, ...) +void debugp(unsigned int subsys, char *file, int line, int cont, const char *format, ...) { - char *timestr; va_list ap; - time_t tm; FILE *outfd = stderr; if (!(debug_mask & subsys)) @@ -110,10 +108,16 @@ void debugp(unsigned int subsys, char *file, int line, const char *format, ...) va_start(ap, format); - tm = time(NULL); - timestr = ctime(&tm); - timestr[strlen(timestr)-1] = '\0'; - fprintf(outfd, "%s%s <%4.4x> %s:%d ", color(subsys), timestr, subsys, file, line); + fprintf(outfd, "%s", color(subsys)); + + if (!cont) { + char *timestr; + time_t tm; + tm = time(NULL); + timestr = ctime(&tm); + timestr[strlen(timestr)-1] = '\0'; + fprintf(outfd, "%s <%4.4x> %s:%d ", timestr, subsys, file, line); + } vfprintf(outfd, format, ap); fprintf(outfd, "\033[0;m"); -- cgit v1.2.3