Windows: Only write to stdout if there is no debugger

directional-lights
Lukas Werling 2016-10-11 18:01:20 +02:00
parent 510d91fd00
commit 170a793a44
1 changed files with 11 additions and 2 deletions

View File

@ -166,8 +166,17 @@ bool LogSilent(const char *szMessage, bool fConsole)
// Write to console
if (fConsole)
{
fputs(TimeMessage.getData(),stdout);
fflush(stdout);
#if defined(_WIN32)
// debug: output to VC console when running with debugger
// Otherwise, print to stdout to allow capturing the log.
if (IsDebuggerPresent())
OutputDebugString(TimeMessage.GetWideChar());
else
#endif
{
fputs(TimeMessage.getData(),stdout);
fflush(stdout);
}
}
}