summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-08-13 13:28:45 +0200
committermadmaxoft <github@xoft.cz>2014-08-13 13:28:45 +0200
commit5921f78e523b3998e72f9c681b8211fd2bc99127 (patch)
treedf1b01ef90ebc15fc16eff34b7a1f5845002012d
parentLogger: Fixed missing timestamp in log messages. (diff)
downloadcuberite-5921f78e523b3998e72f9c681b8211fd2bc99127.tar
cuberite-5921f78e523b3998e72f9c681b8211fd2bc99127.tar.gz
cuberite-5921f78e523b3998e72f9c681b8211fd2bc99127.tar.bz2
cuberite-5921f78e523b3998e72f9c681b8211fd2bc99127.tar.lz
cuberite-5921f78e523b3998e72f9c681b8211fd2bc99127.tar.xz
cuberite-5921f78e523b3998e72f9c681b8211fd2bc99127.tar.zst
cuberite-5921f78e523b3998e72f9c681b8211fd2bc99127.zip
Diffstat (limited to '')
-rw-r--r--src/LoggerListeners.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/LoggerListeners.cpp b/src/LoggerListeners.cpp
index 912342a65..b86ab4127 100644
--- a/src/LoggerListeners.cpp
+++ b/src/LoggerListeners.cpp
@@ -17,6 +17,7 @@
class cColouredConsoleListener
: public cLogger::cListener
{
+ protected:
virtual void SetLogColour(cLogger::eLogLevel a_LogLevel) = 0;
virtual void SetDefaultLogColour() = 0;
@@ -24,7 +25,7 @@
virtual void Log(AString a_Message, cLogger::eLogLevel a_LogLevel) override
{
SetLogColour(a_LogLevel);
- puts(a_Message.c_str());
+ fputs(a_Message.c_str(), stdout);
SetDefaultLogColour();
}
};
@@ -46,7 +47,7 @@
{
}
- #ifdef DEBUG
+ #ifdef _DEBUG
virtual void Log(AString a_Message, cLogger::eLogLevel a_LogLevel) override
{
super::Log(a_Message, a_LogLevel);
@@ -289,31 +290,31 @@ cFileListener::cFileListener(void)
void cFileListener::Log(AString a_Message, cLogger::eLogLevel a_LogLevel)
{
- AString LogLevelString;
+ const char * LogLevelPrefix = "U ";
switch (a_LogLevel)
{
case cLogger::llRegular:
{
- LogLevelString = "Log";
+ LogLevelPrefix = " ";
break;
}
case cLogger::llInfo:
{
- LogLevelString = "Info";
+ LogLevelPrefix = "i ";
break;
}
case cLogger::llWarning:
{
- LogLevelString = "Warning";
+ LogLevelPrefix = "W ";
break;
}
case cLogger::llError:
{
- LogLevelString = "Error";
+ LogLevelPrefix = "E ";
break;
}
}
- m_File.Printf("%s: %s", LogLevelString.c_str(), a_Message.c_str());
+ m_File.Printf("%s: %s", LogLevelPrefix, a_Message.c_str());
}