added timestamp for the debugprint if it's not stdout

This commit is contained in:
crich 2006-06-29 11:43:03 +00:00
parent 2964149b25
commit 3ce3fd90f5
1 changed files with 8 additions and 0 deletions

View File

@ -1,4 +1,5 @@
#include <stdarg.h>
#include <time.h>
#include "isdn_debug.h"
@ -88,9 +89,16 @@ dprint(unsigned int mask, const char *fmt, ...)
{
int ret = 0;
va_list args;
time_t tm = time(NULL);
char *tmp=ctime(&tm),*p;
p=strchr(tmp,'\n');
if (p) *p=':';
va_start(args, fmt);
if (debug_mask & mask) {
if (debug_file != stdout)
fprintf(debug_file, "%s ",tmp);
ret = vfprintf(debug_file, fmt, args);
if (debug_file != stdout)
fflush(debug_file);