summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2014-01-31 21:50:29 +0100
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2014-01-31 21:50:29 +0100
commit02e752789399ad1b65a0443534ea6a8721efd78c (patch)
treed4e2105df2444cc9c57a9f72e2296c97a8e44755
parentAdded a comment (diff)
downloadcuberite-02e752789399ad1b65a0443534ea6a8721efd78c.tar
cuberite-02e752789399ad1b65a0443534ea6a8721efd78c.tar.gz
cuberite-02e752789399ad1b65a0443534ea6a8721efd78c.tar.bz2
cuberite-02e752789399ad1b65a0443534ea6a8721efd78c.tar.lz
cuberite-02e752789399ad1b65a0443534ea6a8721efd78c.tar.xz
cuberite-02e752789399ad1b65a0443534ea6a8721efd78c.tar.zst
cuberite-02e752789399ad1b65a0443534ea6a8721efd78c.zip
-rw-r--r--src/Log.cpp3
-rw-r--r--src/Log.h2
-rw-r--r--src/MCLogger.cpp14
-rw-r--r--src/MCLogger.h4
4 files changed, 13 insertions, 10 deletions
diff --git a/src/Log.cpp b/src/Log.cpp
index cbb83097c..3938f2c24 100644
--- a/src/Log.cpp
+++ b/src/Log.cpp
@@ -18,7 +18,8 @@
cLog* cLog::s_Log = NULL;
cLog::cLog(const AString & a_FileName )
- : m_File(NULL)
+ : m_File(NULL),
+ m_LastStringSize(0)
{
s_Log = this;
diff --git a/src/Log.h b/src/Log.h
index c8c26913b..8a0ee9fc7 100644
--- a/src/Log.h
+++ b/src/Log.h
@@ -10,7 +10,7 @@ class cLog
private:
FILE * m_File;
static cLog * s_Log;
- size_t m_LastStringSize = 0;
+ size_t m_LastStringSize;
public:
cLog(const AString & a_FileName);
~cLog();
diff --git a/src/MCLogger.cpp b/src/MCLogger.cpp
index aebe3e1c9..b7b826374 100644
--- a/src/MCLogger.cpp
+++ b/src/MCLogger.cpp
@@ -11,10 +11,6 @@
cMCLogger * cMCLogger::s_MCLogger = NULL;
bool g_ShouldColorOutput = false;
-/** Flag to show whether a 'replace line' log command has been issued
-Used to decide when to put a newline */
-bool g_BeginLineUpdate = false;
-
#ifdef _WIN32
#include <io.h> // Needed for _isatty(), not available on Linux
@@ -38,6 +34,7 @@ cMCLogger * cMCLogger::GetInstance(void)
cMCLogger::cMCLogger(void)
+ : m_BeginLineUpdate(false)
{
AString FileName;
Printf(FileName, "LOG_%d.txt", (int)time(NULL));
@@ -49,6 +46,7 @@ cMCLogger::cMCLogger(void)
cMCLogger::cMCLogger(const AString & a_FileName)
+ : m_BeginLineUpdate(false)
{
InitLog(a_FileName);
}
@@ -127,14 +125,14 @@ void cMCLogger::Log(const char * a_Format, va_list a_ArgList, bool a_ShouldRepla
{
cCSLock Lock(m_CriticalSection);
- if (!g_BeginLineUpdate && a_ShouldReplaceLine)
+ if (!m_BeginLineUpdate && a_ShouldReplaceLine)
{
a_ShouldReplaceLine = false; // Print a normal line first if this is the initial replace line
- g_BeginLineUpdate = true;
+ m_BeginLineUpdate = true;
}
- else if (g_BeginLineUpdate && !a_ShouldReplaceLine)
+ else if (m_BeginLineUpdate && !a_ShouldReplaceLine)
{
- g_BeginLineUpdate = false;
+ m_BeginLineUpdate = false;
}
if (a_ShouldReplaceLine)
diff --git a/src/MCLogger.h b/src/MCLogger.h
index c105ab6e2..4550cc55d 100644
--- a/src/MCLogger.h
+++ b/src/MCLogger.h
@@ -51,6 +51,10 @@ private:
/// Common initialization for all constructors, creates a logfile with the specified name and assigns s_MCLogger to this
void InitLog(const AString & a_FileName);
+
+ /** Flag to show whether a 'replace line' log command has been issued
+ Used to decide when to put a newline */
+ bool m_BeginLineUpdate;
}; // tolua_export