diff options
author | Julian Laubstein <julianlaubstein@yahoo.de> | 2015-08-08 11:15:48 +0200 |
---|---|---|
committer | Julian Laubstein <julianlaubstein@yahoo.de> | 2015-08-08 11:15:48 +0200 |
commit | 171e754a6ea7b71fe755a81c9b01fb2d4f860bae (patch) | |
tree | 879c4cbdabc1b78ac825ac45cd28c14ec83ab750 | |
parent | Refactored code to use cLuaState (diff) | |
parent | Flush log file when a warning or error message is output. (diff) | |
download | cuberite-171e754a6ea7b71fe755a81c9b01fb2d4f860bae.tar cuberite-171e754a6ea7b71fe755a81c9b01fb2d4f860bae.tar.gz cuberite-171e754a6ea7b71fe755a81c9b01fb2d4f860bae.tar.bz2 cuberite-171e754a6ea7b71fe755a81c9b01fb2d4f860bae.tar.lz cuberite-171e754a6ea7b71fe755a81c9b01fb2d4f860bae.tar.xz cuberite-171e754a6ea7b71fe755a81c9b01fb2d4f860bae.tar.zst cuberite-171e754a6ea7b71fe755a81c9b01fb2d4f860bae.zip |
Diffstat (limited to '')
-rw-r--r-- | src/LoggerListeners.cpp | 7 |
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(); + } } |