diff options
| author | Bent Bisballe Nyeng <deva@aasimon.org> | 2012-11-02 14:08:39 +0100 | 
|---|---|---|
| committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2012-11-02 14:08:39 +0100 | 
| commit | 2f6d64ad096817a13c90af63f3cfd229e9b42122 (patch) | |
| tree | a56fe5419dc98c2df35c2ee4f9cdc39210a99ca5 | |
| parent | b1d8896cbac3c283bb5c0a724f7e9f28623fbf82 (diff) | |
New date format.
| -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); | 
