summaryrefslogtreecommitdiff
path: root/src/logger.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2018-02-16 02:34:40 +0300
committerAndrei Karas <akaras@inbox.ru>2018-02-16 02:34:40 +0300
commit9b3e17bbce13963d61008d7ab73d3d959725c305 (patch)
treef40d8987605b1ae4e5adf8ee879cf5bed09d9961 /src/logger.cpp
parent1e68125a911d426df22281690f09396158ba5ded (diff)
downloadmv-9b3e17bbce13963d61008d7ab73d3d959725c305.tar.gz
mv-9b3e17bbce13963d61008d7ab73d3d959725c305.tar.bz2
mv-9b3e17bbce13963d61008d7ab73d3d959725c305.tar.xz
mv-9b3e17bbce13963d61008d7ab73d3d959725c305.zip
Add flush in logger for improve log saving.
Diffstat (limited to 'src/logger.cpp')
-rw-r--r--src/logger.cpp5
1 files changed, 5 insertions, 0 deletions
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);
}