summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-06-27 21:35:16 +0300
committerAndrei Karas <akaras@inbox.ru>2017-06-27 21:35:16 +0300
commit34f6df585176b38e8cd6744b2b1f7c03aa1d2dd6 (patch)
tree4478bb8ce6cd700c4169ea73babb86f5616ed89c
parent6c8cc8cdf6286e19f2af1f994e19604ba01a9af3 (diff)
downloadplus-34f6df585176b38e8cd6744b2b1f7c03aa1d2dd6.tar.gz
plus-34f6df585176b38e8cd6744b2b1f7c03aa1d2dd6.tar.bz2
plus-34f6df585176b38e8cd6744b2b1f7c03aa1d2dd6.tar.xz
plus-34f6df585176b38e8cd6744b2b1f7c03aa1d2dd6.zip
Fix flushing log data from non main thread.
Before it was buffered before any logging data from main thread.
-rw-r--r--src/logger.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/logger.cpp b/src/logger.cpp
index 48578c20d..9e8e1be3e 100644
--- a/src/logger.cpp
+++ b/src/logger.cpp
@@ -336,7 +336,7 @@ void Logger::log_r(const char *const log_text, ...)
if (mLogFile.is_open())
{
- timeStr << buf << std::endl;
+ timeStr << buf;
mThreadLocked = true;
mDelayedLog.push_back(timeStr.str());
mThreadLocked = false;
@@ -357,7 +357,7 @@ void Logger::flush()
{
SDL_mutexP(mMutex);
FOR_EACH (std::vector<std::string>::const_iterator, it, mDelayedLog)
- mLogFile << *it;
+ mLogFile << *it << std::endl;
mDelayedLog.clear();
SDL_mutexV(mMutex);
}