diff options
author | Tycho <work.tycho+git@gmail.com> | 2014-08-12 17:05:04 +0200 |
---|---|---|
committer | Tycho <work.tycho+git@gmail.com> | 2014-08-12 17:05:04 +0200 |
commit | 98443682671d0c39b19f86098f7bc900b7529b72 (patch) | |
tree | d76a93bd70740b6c718c98a47b1159eb6df2315e /src/Logger.h | |
parent | Fixed Tools to work with new logging framework (diff) | |
download | cuberite-98443682671d0c39b19f86098f7bc900b7529b72.tar cuberite-98443682671d0c39b19f86098f7bc900b7529b72.tar.gz cuberite-98443682671d0c39b19f86098f7bc900b7529b72.tar.bz2 cuberite-98443682671d0c39b19f86098f7bc900b7529b72.tar.lz cuberite-98443682671d0c39b19f86098f7bc900b7529b72.tar.xz cuberite-98443682671d0c39b19f86098f7bc900b7529b72.tar.zst cuberite-98443682671d0c39b19f86098f7bc900b7529b72.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Logger.h (renamed from src/LogDispacher.h) | 42 |
1 files changed, 17 insertions, 25 deletions
diff --git a/src/LogDispacher.h b/src/Logger.h index 1472b392a..5e65de8a8 100644 --- a/src/LogDispacher.h +++ b/src/Logger.h @@ -2,8 +2,9 @@ #pragma once -namespace Logger +class cLogger { +public: enum eLogLevel { @@ -13,41 +14,32 @@ namespace Logger llError, }; - class cLogDispacher; - // Must be called before calling GetInstance in a multithreaded context - void InitiateMultithreading(); - - cLogDispacher & GetInstance(void); - - class cLoggerListener + class cListener { public: virtual void Log(AString a_Message, eLogLevel a_LogLevel) = 0; - - virtual ~cLoggerListener(){} + + virtual ~cListener(){} }; - class cLogDispacher - { - public: + void Log (const char * a_Format, eLogLevel a_LogLevel, va_list a_ArgList) FORMATSTRING(2, 0); - void Log (const char * a_Format, Logger::eLogLevel a_LogLevel, va_list a_ArgList) FORMATSTRING(2, 0); + /** Logs the simple text message at the specified log level. */ + void LogSimple(AString a_Message, eLogLevel a_LogLevel = llRegular); - /** Logs the simple text message at the specified log level. */ - void LogSimple(AString a_Message, Logger::eLogLevel a_LogLevel = Logger::llRegular); + void AttachListener(cListener * a_Listener); + void DetachListener(cListener * a_Listener); - void AttachListener(Logger::cLoggerListener * a_Listener); - void DetachListener(Logger::cLoggerListener * a_Listener); + static cLogger & GetInstance(void); + // Must be called before calling GetInstance in a multithreaded context + static void InitiateMultithreading(); +private: - private: - - cCriticalSection m_CriticalSection; - std::vector<Logger::cLoggerListener *> m_LogListeners; - - }; + cCriticalSection m_CriticalSection; + std::vector<cListener *> m_LogListeners; -} +}; |