[Common] Get trace.cpp code more android friendly
This commit is contained in:
parent
25056aa2e8
commit
3d67aa563d
|
@ -1,4 +1,5 @@
|
|||
#include "stdafx.h"
|
||||
#include <Common/Thread.h>
|
||||
#ifdef _WIN32
|
||||
#include <Windows.h>
|
||||
#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());
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue