diff --git a/Source/Common/Trace.cpp b/Source/Common/Trace.cpp index 2012e8c67..fffcc3449 100644 --- a/Source/Common/Trace.cpp +++ b/Source/Common/Trace.cpp @@ -1,4 +1,5 @@ #include "stdafx.h" +#include #ifdef _WIN32 #include #else @@ -199,7 +200,7 @@ void CTraceFileLog::Write(uint32_t module, uint8_t severity, const char * /*file #ifdef _WIN32 SYSTEMTIME sysTime; ::GetLocalTime(&sysTime); - stdstr_f timestamp("%04d/%02d/%02d %02d:%02d:%02d.%03d %05d,", sysTime.wYear, sysTime.wMonth, sysTime.wDay, sysTime.wHour, sysTime.wMinute, sysTime.wSecond, sysTime.wMilliseconds, GetCurrentThreadId()); + stdstr_f timestamp("%04d/%02d/%02d %02d:%02d:%02d.%03d %05d,", sysTime.wYear, sysTime.wMonth, sysTime.wDay, sysTime.wHour, sysTime.wMinute, sysTime.wSecond, sysTime.wMilliseconds, CThread::GetCurrentThreadId()); #else time_t ltime; ltime=time(<ime); @@ -211,7 +212,7 @@ void CTraceFileLog::Write(uint32_t module, uint8_t severity, const char * /*file gettimeofday(&curTime, NULL); int milliseconds = curTime.tv_usec / 1000; - stdstr_f timestamp("%04d/%02d/%02d %02d:%02d:%02d.%03d %05d,", result.tm_year+1900, result.tm_mon+1, result.tm_mday, result.tm_hour, result.tm_min, result.tm_sec, milliseconds, GetCurrentThreadId()); + stdstr_f timestamp("%04d/%02d/%02d %02d:%02d:%02d.%03d %05d,", result.tm_year+1900, result.tm_mon+1, result.tm_mday, result.tm_hour, result.tm_min, result.tm_sec, milliseconds, CThread::GetCurrentThreadId()); #endif m_hLogFile.Log(timestamp.c_str()); diff --git a/Source/Common/Trace.h b/Source/Common/Trace.h index de25d4d7a..58aa0a1c7 100644 --- a/Source/Common/Trace.h +++ b/Source/Common/Trace.h @@ -36,7 +36,11 @@ private: bool m_FlushFile; }; +#ifdef _WIN32 #define WriteTrace(m, s, format, ...) if(g_ModuleLogLevel[(m)] >= (s)) { WriteTraceFull((m), (s), __FILE__, __LINE__, __FUNCTION__, (format), ## __VA_ARGS__); } +#else +#define WriteTrace(m, s, format, ...) if(g_ModuleLogLevel[(m)] >= (s)) { WriteTraceFull((m), (s), __FILE__, __LINE__, __PRETTY_FUNCTION__, (format), ## __VA_ARGS__); } +#endif CTraceModule * TraceAddModule(CTraceModule * TraceModule); CTraceModule * TraceRemoveModule(CTraceModule * TraceModule);