summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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();
+ }
}