diff options
-rw-r--r-- | debug.cc | 14 |
1 files changed, 10 insertions, 4 deletions
@@ -77,15 +77,21 @@ int __debug(const char *func, const int line, const char *ch, const char *fmt, ...) { time_t rawtime = time(NULL); - char* timestr = ctime(&rawtime); - *(timestr+strlen(timestr)-1) = '\0'; + struct tm *t = localtime(&rawtime); // MutexAutolock m(mutex); int ret = 0; if(__debug_enabled(cl, ch)) { if((unsigned)cl < NELEM(debug_class_str)) - ret += fprintf(logfp, "[%s] %u %s:%s:%s:%d ", - timestr, gettid(), debug_class_str[(unsigned)cl], ch, func, line); + ret += fprintf(logfp, "%d-%02d-%02d %02d:%02d:%02d %u %s:%s:%s:%d ", + t->tm_year + 1900, + t->tm_mon + 1, + t->tm_mday, + t->tm_hour, + t->tm_min, + t->tm_sec, + gettid(), + debug_class_str[(unsigned)cl], ch, func, line); if(fmt) { va_list va; va_start(va, fmt); |