From 19781ecad53c37adc99c4f9b3044b2fb956071c5 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Sat, 10 Aug 2013 13:03:05 +0200 Subject: [PATCH] Coloring is reset before the LF. --- source/Log.cpp | 6 +++--- source/MCLogger.cpp | 10 ++++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/source/Log.cpp b/source/Log.cpp index 5f78bba1..2b505de5 100644 --- a/source/Log.cpp +++ b/source/Log.cpp @@ -117,13 +117,13 @@ void cLog::Log(const char * a_Format, va_list argList) AString Line; #ifdef _DEBUG - Printf(Line, "[%04x|%02d:%02d:%02d] %s\n", cIsThread::GetCurrentID(), timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec, Message.c_str()); + Printf(Line, "[%04x|%02d:%02d:%02d] %s", cIsThread::GetCurrentID(), timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec, Message.c_str()); #else - Printf(Line, "[%02d:%02d:%02d] %s\n", timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec, Message.c_str()); + Printf(Line, "[%02d:%02d:%02d] %s", timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec, Message.c_str()); #endif if (m_File) { - fputs(Line.c_str(), m_File); + fprintf(m_File, "%s\n", Line.c_str(), m_File); fflush(m_File); } diff --git a/source/MCLogger.cpp b/source/MCLogger.cpp index 80cbf740..4442fc5b 100644 --- a/source/MCLogger.cpp +++ b/source/MCLogger.cpp @@ -18,8 +18,6 @@ bool g_ShouldColorOutput = false; WORD g_DefaultConsoleAttrib = 0x07; #elif defined (__linux) && !defined(ANDROID_NDK) #include // Needed for isatty() on Linux - - bool g_ShouldColorOutput; #endif @@ -40,7 +38,7 @@ cMCLogger::cMCLogger(void) AString FileName; Printf(FileName, "LOG_%d.txt", (int)time(NULL)); m_Log = new cLog(FileName); - m_Log->Log("--- Started Log ---"); + m_Log->Log("--- Started Log ---\n"); s_MCLogger = this; @@ -74,7 +72,7 @@ cMCLogger::cMCLogger(const AString & a_FileName) cMCLogger::~cMCLogger() { - m_Log->Log("--- Stopped Log ---"); + m_Log->Log("--- Stopped Log ---\n"); delete m_Log; if (this == s_MCLogger) s_MCLogger = NULL; @@ -116,6 +114,7 @@ void cMCLogger::Log(const char * a_Format, va_list a_ArgList) SetColor(csRegular); m_Log->Log(a_Format, a_ArgList); ResetColor(); + puts(""); } @@ -128,6 +127,7 @@ void cMCLogger::Info(const char * a_Format, va_list a_ArgList) SetColor(csInfo); m_Log->Log(a_Format, a_ArgList); ResetColor(); + puts(""); } @@ -140,6 +140,7 @@ void cMCLogger::Warn(const char * a_Format, va_list a_ArgList) SetColor(csWarning); m_Log->Log(a_Format, a_ArgList); ResetColor(); + puts(""); } @@ -152,6 +153,7 @@ void cMCLogger::Error(const char * a_Format, va_list a_ArgList) SetColor(csError); m_Log->Log(a_Format, a_ArgList); ResetColor(); + puts(""); }