Adjust logging to make STK less annoying to debug under visual studio : output the logging directly to VS's output pane, instead of having to reply on the small cmd.exe popup that closes as soon as the application exits

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@14807 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2013-12-27 03:02:33 +00:00
parent 053170fc27
commit f1aac9e317

View File

@ -163,6 +163,10 @@ void Log::printMessage(int level, const char *component, const char *format,
{
va_copy(copy, args);
}
#if defined(_MSC_FULL_VER) && defined(_DEBUG)
VALIST copy2;
va_copy(copy2, args);
#endif
// If we don't have a console file, write to stdout and hope for the best
if(!m_file_stdout || level >= LL_WARN ||
@ -178,6 +182,21 @@ void Log::printMessage(int level, const char *component, const char *format,
va_end(out);
}
#if defined(_MSC_FULL_VER) && defined(_DEBUG)
static char szBuff[2048];
vsnprintf(szBuff, sizeof(szBuff), format, copy2);
OutputDebugString("[");
OutputDebugString(names[level]);
OutputDebugString("] ");
OutputDebugString(component);
OutputDebugString(": ");
OutputDebugString(szBuff);
OutputDebugString("\r\n");
#endif
if(m_file_stdout)
{
fprintf (m_file_stdout, "[%s] %s: ", names[level], component);