summaryrefslogtreecommitdiffstats
path: root/src/debug.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2009-02-06 12:38:29 +0000
committerHarald Welte <laforge@gnumonks.org>2009-02-06 12:38:29 +0000
commit6ddd1683b5c679582b751eaaefad089a7efe1c83 (patch)
treec858f704ef050fd88bbed0488430bdd5f3ee391a /src/debug.c
parentb60fa59276f6366c129ee02f24d0287edc4fcb3a (diff)
introduce new "DEBUGPC" macro for continuing on the same line without prefix of file/line/time
Diffstat (limited to 'src/debug.c')
-rw-r--r--src/debug.c18
1 files changed, 11 insertions, 7 deletions
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");