diff options
author | Jonas Suhr Christensen <jsc@umbraculum.org> | 2012-11-02 10:14:20 +0100 |
---|---|---|
committer | Jonas Suhr Christensen <jsc@umbraculum.org> | 2012-11-02 10:14:20 +0100 |
commit | b1d8896cbac3c283bb5c0a724f7e9f28623fbf82 (patch) | |
tree | f3ef1e021ad69c05edd6a7373416f4f61e97150b /debug.cc | |
parent | a32e833c161a0dbcb94e939e75465ee302a8e0bb (diff) |
Added date as prefix to output.
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); |