diff options
author | Harald Welte <laforge@gnumonks.org> | 2009-06-09 20:21:57 +0000 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2009-06-09 20:21:57 +0000 |
commit | d3ff51dfe3ecfde0ddbcd7bc5645d519912696dd (patch) | |
tree | 1d4ff26596b56a8388f1a2ce7f502acf20cfab37 /src/debug.c | |
parent | bd8f7e399b3c6e14edd9bd59ee3ebed97b0954a6 (diff) |
don't prefix every line with timestamp, this saves some screen real estate
Diffstat (limited to 'src/debug.c')
-rw-r--r-- | src/debug.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/src/debug.c b/src/debug.c index 9bca07a83..aeb993097 100644 --- a/src/debug.c +++ b/src/debug.c @@ -65,6 +65,14 @@ void debug_use_color(int color) use_color = color; } +static int print_timestamp = 0; + +void debug_timestamp(int enable) +{ + print_timestamp = enable; +} + + /* * Parse the category mask. * category1:category2:category3 @@ -114,12 +122,15 @@ void debugp(unsigned int subsys, char *file, int line, int cont, const char *for 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); + if (print_timestamp) { + char *timestr; + time_t tm; + tm = time(NULL); + timestr = ctime(&tm); + timestr[strlen(timestr)-1] = '\0'; + fprintf(outfd, "%s ", timestr); + } + fprintf(outfd, "<%4.4x> %s:%d ", subsys, file, line); } vfprintf(outfd, format, ap); fprintf(outfd, "\033[0;m"); |