Merge pull request #101 from Ardakaniz/master

Core/*Logger: Make some functions const add possibility of setting a logger prior to initialization
This commit is contained in:
Jérôme Leclercq 2016-10-16 21:51:35 +02:00 committed by GitHub
commit 59d3a2a3fb
6 changed files with 10 additions and 8 deletions

View File

@ -21,7 +21,7 @@ namespace Nz
virtual void EnableStdReplication(bool enable) = 0; virtual void EnableStdReplication(bool enable) = 0;
virtual bool IsStdReplicationEnabled() = 0; virtual bool IsStdReplicationEnabled() const = 0;
virtual void Write(const String& string) = 0; virtual void Write(const String& string) = 0;
virtual void WriteError(ErrorType type, const String& error, unsigned int line = 0, const char* file = nullptr, const char* function = nullptr); virtual void WriteError(ErrorType type, const String& error, unsigned int line = 0, const char* file = nullptr, const char* function = nullptr);

View File

@ -25,8 +25,8 @@ namespace Nz
void EnableTimeLogging(bool enable); void EnableTimeLogging(bool enable);
void EnableStdReplication(bool enable) override; void EnableStdReplication(bool enable) override;
bool IsStdReplicationEnabled() override; bool IsStdReplicationEnabled() const override;
bool IsTimeLoggingEnabled(); bool IsTimeLoggingEnabled() const;
void Write(const String& string) override; void Write(const String& string) override;
void WriteError(ErrorType type, const String& error, unsigned int line = 0, const char* file = nullptr, const char* function = nullptr) override; void WriteError(ErrorType type, const String& error, unsigned int line = 0, const char* file = nullptr, const char* function = nullptr) override;

View File

@ -22,7 +22,7 @@ namespace Nz
void EnableStdReplication(bool enable) override; void EnableStdReplication(bool enable) override;
bool IsStdReplicationEnabled() override; bool IsStdReplicationEnabled() const override;
void Write(const String& string) override; void Write(const String& string) override;
void WriteError(ErrorType type, const String& error, unsigned int line = 0, const char* file = nullptr, const char* function = nullptr) override; void WriteError(ErrorType type, const String& error, unsigned int line = 0, const char* file = nullptr, const char* function = nullptr) override;

View File

@ -65,7 +65,7 @@ namespace Nz
* \return true If replication is enabled * \return true If replication is enabled
*/ */
bool FileLogger::IsStdReplicationEnabled() bool FileLogger::IsStdReplicationEnabled() const
{ {
return m_stdReplicationEnabled; return m_stdReplicationEnabled;
} }
@ -75,7 +75,7 @@ namespace Nz
* \return true If logging of the time is enabled * \return true If logging of the time is enabled
*/ */
bool FileLogger::IsTimeLoggingEnabled() bool FileLogger::IsTimeLoggingEnabled() const
{ {
return m_timeLoggingEnabled; return m_timeLoggingEnabled;
} }

View File

@ -111,7 +111,9 @@ namespace Nz
bool Log::Initialize() bool Log::Initialize()
{ {
if (s_logger == &s_stdLogger)
SetLogger(new FileLogger()); SetLogger(new FileLogger());
return true; return true;
} }

View File

@ -47,7 +47,7 @@ namespace Nz
* \return Always returns true * \return Always returns true
*/ */
bool StdLogger::IsStdReplicationEnabled() bool StdLogger::IsStdReplicationEnabled() const
{ {
return true; return true;
} }