diff options
Diffstat (limited to 'debug.cc')
-rw-r--r-- | debug.cc | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -32,6 +32,7 @@ #include <string.h> //#include <pthread.h> #include <string> +#include <time.h> //#include "mutex.h" @@ -75,12 +76,16 @@ int __debug(const char *func, const int line, const enum __debug_class cl, const char *ch, const char *fmt, ...) { + time_t rawtime = time(NULL); + char* timestr = ctime(&rawtime); + *(timestr+strlen(timestr)-1) = '\0'; + // MutexAutolock m(mutex); int ret = 0; if(__debug_enabled(cl, ch)) { if((unsigned)cl < NELEM(debug_class_str)) - ret += fprintf(logfp, "%u %s:%s:%s:%d ", - gettid(), debug_class_str[(unsigned)cl], ch, func, line); + ret += fprintf(logfp, "[%s] %u %s:%s:%s:%d ", + timestr, gettid(), debug_class_str[(unsigned)cl], ch, func, line); if(fmt) { va_list va; va_start(va, fmt); |