1
0

Logging: added thread ID to the log output in debug builds

git-svn-id: http://mc-server.googlecode.com/svn/trunk@291 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
madmaxoft@gmail.com 2012-02-18 17:51:34 +00:00
parent a0c29514d2
commit 57dedd585c
3 changed files with 11 additions and 7 deletions

View File

@ -5,9 +5,10 @@
#include <fstream> #include <fstream>
#include <ctime> #include <ctime>
#include <stdarg.h>
#include "cMakeDir.h" #include "cMakeDir.h"
#include "cIsThread.h"
@ -120,7 +121,11 @@ void cLog::Log(const char * a_Format, va_list argList)
#endif #endif
AString Line; AString Line;
#ifdef _DEBUG
Printf(Line, "[%04x|%02d:%02d:%02d] %s\n", cIsThread::GetCurrentID(), timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec, Message.c_str());
#else
Printf(Line, "[%02d:%02d:%02d] %s\n", timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec, Message.c_str()); Printf(Line, "[%02d:%02d:%02d] %s\n", timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec, Message.c_str());
#endif
if (m_File) if (m_File)
{ {
fputs(Line.c_str(), m_File); fputs(Line.c_str(), m_File);

View File

@ -1,12 +1,8 @@
#pragma once #pragma once
#include "MemoryLeak.h"
#include "FileDefine.h" #include "FileDefine.h"
#ifndef _WIN32
#include <stdarg.h>
#endif

View File

@ -1,7 +1,6 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules #include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include <cstdarg>
#include <time.h> #include <time.h>
#include "cLog.h" #include "cLog.h"
@ -186,3 +185,7 @@ void LOGERROR(const char* a_Format, ...)
cMCLogger::GetInstance()->Error( a_Format, argList ); cMCLogger::GetInstance()->Error( a_Format, argList );
va_end(argList); va_end(argList);
} }