From 60f6c00f2e4fedc0f9d236bdb03350e592b06a10 Mon Sep 17 00:00:00 2001 From: beegee1 Date: Sat, 10 May 2014 21:12:33 +0200 Subject: [PATCH] Logging API: - removed unused method declaration - updated comments - ensured thread safety --- lib/logging/CLogger.cpp | 2 +- lib/logging/CLogger.h | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/logging/CLogger.cpp b/lib/logging/CLogger.cpp index 53a203982..b9f84a4cc 100644 --- a/lib/logging/CLogger.cpp +++ b/lib/logging/CLogger.cpp @@ -60,7 +60,7 @@ DLL_LINKAGE CLogger * logAnim = CLogger::getLogger(CLoggerDomain("animation")); CLogger * CLogger::getLogger(const CLoggerDomain & domain) { - boost::lock_guard _(smx); + TLockGuardRec _(smx); CLogger * logger = CLogManager::get().getLogger(domain); if(logger) diff --git a/lib/logging/CLogger.h b/lib/logging/CLogger.h index efa0acb13..9e5afe2db 100644 --- a/lib/logging/CLogger.h +++ b/lib/logging/CLogger.h @@ -69,7 +69,8 @@ private: std::stringstream * sbuffer; }; -/// The class CLogger is used to log messages to certain targets of a specific domain/name. +/// The logger is used to log messages to certain targets of a specific domain/name. +/// It is thread-safe and can be used concurrently by several threads. class DLL_LINKAGE CLogger { public: @@ -109,7 +110,6 @@ public: private: explicit CLogger(const CLoggerDomain & domain); - CLogger * getParent() const; inline ELogLevel::ELogLevel getEffectiveLevel() const; /// Returns the log level applied on this logger whether directly or indirectly. inline void callTargets(const LogRecord & record) const; @@ -245,7 +245,9 @@ private: std::map > map; }; -/// The class CLogConsoleTarget is a logging target which writes message to the console. +/// This target is a logging target which writes message to the console. +/// The target may be shared among multiple loggers. All methods except write aren't thread-safe. +/// The console target is intended to be configured once and then added to a logger. class DLL_LINKAGE CLogConsoleTarget : public ILogTarget { public: @@ -274,7 +276,9 @@ private: mutable boost::mutex mx; }; -/// The class CLogFileTarget is a logging target which writes messages to a log file. +/// This target is a logging target which writes messages to a log file. +/// The target may be shared among multiple loggers. All methods except write aren't thread-safe. +/// The file target is intended to be configured once and then added to a logger. class DLL_LINKAGE CLogFileTarget : public ILogTarget { public: