diff options
Diffstat (limited to 'src/common/Logging')
-rw-r--r-- | src/common/Logging/Log.cpp | 13 | ||||
-rw-r--r-- | src/common/Logging/Log.h | 7 |
2 files changed, 15 insertions, 5 deletions
diff --git a/src/common/Logging/Log.cpp b/src/common/Logging/Log.cpp index a80a4671822..f7a84fb8b47 100644 --- a/src/common/Logging/Log.cpp +++ b/src/common/Logging/Log.cpp @@ -320,6 +320,12 @@ void Log::Close() appenders.clear(); } +Log* Log::instance() +{ + static Log instance; + return &instance; +} + void Log::Initialize(boost::asio::io_service* ioService) { if (ioService) @@ -331,6 +337,13 @@ void Log::Initialize(boost::asio::io_service* ioService) LoadFromConfig(); } +void Log::SetSynchronous() +{ + delete _strand; + _strand = nullptr; + _ioService = nullptr; +} + void Log::LoadFromConfig() { Close(); diff --git a/src/common/Logging/Log.h b/src/common/Logging/Log.h index a90481ad5d2..062f14d525c 100644 --- a/src/common/Logging/Log.h +++ b/src/common/Logging/Log.h @@ -44,13 +44,10 @@ class Log public: - static Log* instance() - { - static Log instance; - return &instance; - } + static Log* instance(); void Initialize(boost::asio::io_service* ioService); + void SetSynchronous(); // Not threadsafe - should only be called from main() after all threads are joined void LoadFromConfig(); void Close(); bool ShouldLog(std::string const& type, LogLevel level) const; |