Added buffer flushing if a history replay is aborted. Don't print

data to stdout when using buffering (since it slows down flushing).
This commit is contained in:
hiker 2018-02-07 08:32:22 +11:00
parent 5a07739786
commit 1f7350822c
2 changed files with 6 additions and 6 deletions

View File

@ -1771,9 +1771,8 @@ int main(int argc, char *argv[] )
race_manager->setupPlayerKartInfo();
race_manager->startNew(false);
main_loop->run();
// well, actually run() will never return, since
// it exits after replaying history (see history::GetNextDT()).
// So the next line is just to make this obvious here!
// The run() function will only return if the user aborts.
Log::flushBuffers();
exit(-3);
}

View File

@ -189,8 +189,9 @@ void Log::writeLine(const char *line, int level)
{
// If we don't have a console file, write to stdout and hope for the best
if (!m_file_stdout || level >= LL_WARN ||
UserConfigParams::m_log_errors_to_console) // log to console & file
if ( m_buffer_size <= 1 &&
(!m_file_stdout || level >= LL_WARN ||
UserConfigParams::m_log_errors_to_console) ) // log to console
{
setTerminalColor((LogLevel)level);
#ifdef ANDROID
@ -218,7 +219,7 @@ void Log::writeLine(const char *line, int level)
}
#if defined(_MSC_FULL_VER) && defined(_DEBUG)
OutputDebugString(line);
if (m_buffer_size <= 1) OutputDebugString(line);
#endif
if (m_file_stdout) fprintf(m_file_stdout, "%s", line);