summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2015-08-07 12:47:45 +0200
committerMattes D <github@xoft.cz>2015-08-08 10:40:40 +0200
commita985949cfeae4afec979b32acad9aa2a6f9e56a8 (patch)
tree879c4cbdabc1b78ac825ac45cd28c14ec83ab750
parentRefactored code to use cLuaState (diff)
downloadcuberite-a985949cfeae4afec979b32acad9aa2a6f9e56a8.tar
cuberite-a985949cfeae4afec979b32acad9aa2a6f9e56a8.tar.gz
cuberite-a985949cfeae4afec979b32acad9aa2a6f9e56a8.tar.bz2
cuberite-a985949cfeae4afec979b32acad9aa2a6f9e56a8.tar.lz
cuberite-a985949cfeae4afec979b32acad9aa2a6f9e56a8.tar.xz
cuberite-a985949cfeae4afec979b32acad9aa2a6f9e56a8.tar.zst
cuberite-a985949cfeae4afec979b32acad9aa2a6f9e56a8.zip
Diffstat (limited to '')
-rw-r--r--src/LoggerListeners.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/LoggerListeners.cpp b/src/LoggerListeners.cpp
index 91964c57e..ba8139678 100644
--- a/src/LoggerListeners.cpp
+++ b/src/LoggerListeners.cpp
@@ -317,6 +317,7 @@ cFileListener::cFileListener(void)
void cFileListener::Log(AString a_Message, cLogger::eLogLevel a_LogLevel)
{
const char * LogLevelPrefix = "Unkn ";
+ bool ShouldFlush = false;
switch (a_LogLevel)
{
case cLogger::llRegular:
@@ -332,15 +333,21 @@ void cFileListener::Log(AString a_Message, cLogger::eLogLevel a_LogLevel)
case cLogger::llWarning:
{
LogLevelPrefix = "Warn ";
+ ShouldFlush = true;
break;
}
case cLogger::llError:
{
LogLevelPrefix = "Err ";
+ ShouldFlush = true;
break;
}
}
m_File.Printf("%s%s", LogLevelPrefix, a_Message.c_str());
+ if (ShouldFlush)
+ {
+ m_File.Flush();
+ }
}