From 9b3e17bbce13963d61008d7ab73d3d959725c305 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 16 Feb 2018 02:34:40 +0300 Subject: Add flush in logger for improve log saving. --- src/logger.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/logger.cpp b/src/logger.cpp index f068d5b52..4758fa026 100644 --- a/src/logger.cpp +++ b/src/logger.cpp @@ -204,6 +204,7 @@ void Logger::dlog2(const std::string &str, pos, str.c_str()); } + fflush(mLogFile); } if (mLogToStandardOut) @@ -248,6 +249,7 @@ void Logger::log1(const char *const buf) "%s %s\n", timeStr.c_str(), buf); + fflush(mLogFile); } if (mLogToStandardOut) @@ -291,6 +293,7 @@ void Logger::log(const char *const log_text, ...) "%s %s\n", timeStr.c_str(), buf); + fflush(mLogFile); } if (mLogToStandardOut) @@ -337,6 +340,7 @@ void Logger::assertLog(const char *const log_text, ...) "%s %s\n", timeStr.c_str(), buf); + fflush(mLogFile); } if (mLogToStandardOut) @@ -416,6 +420,7 @@ void Logger::flush() fputs((*it).c_str(), mLogFile); fputs("\n", mLogFile); } + fflush(mLogFile); mDelayedLog.clear(); SDL_mutexV(mMutex); } -- cgit v1.2.3-60-g2f50