Mercurial > hg > orthanc
diff OrthancFramework/Sources/Logging.cpp @ 5571:addccb1590d2
simplifying Orthanc::Logging
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 26 Apr 2024 14:48:11 +0200 |
parents | e02cdf358905 |
children | d7eaa568da15 |
line wrap: on
line diff
--- a/OrthancFramework/Sources/Logging.cpp Thu Apr 25 17:16:51 2024 +0200 +++ b/OrthancFramework/Sources/Logging.cpp Fri Apr 26 14:48:11 2024 +0200 @@ -870,10 +870,17 @@ } - void InternalLogger::Setup(LogCategory category, - const char* pluginName, - const char* file, - int line) + InternalLogger::InternalLogger(LogLevel level, + LogCategory category, + const char* pluginName, + const char* file, + int line) : + lock_(loggingStreamsMutex_, boost::defer_lock_t()), + level_(level), + stream_(&nullStream_), // By default, logging to "/dev/null" is simulated + category_(category), + file_(file), + line_(line) { if (pluginContext_ != NULL) { @@ -913,7 +920,9 @@ if (loggingStreamsContext_.get() == NULL) { - fprintf(stderr, "ERROR: Trying to log a message after the finalization of the logging engine (or did you forgot to initialize it ?)\n"); // have you called Orthanc::Logging::InitializePluginContext ? + // Have you called Orthanc::Logging::InitializePluginContext()? + fprintf(stderr, "ERROR: Trying to log a message after the finalization of the logging engine " + "(or did you forgot to initialize it?)\n"); lock_.unlock(); return; } @@ -963,50 +972,6 @@ } - InternalLogger::InternalLogger(LogLevel level, - LogCategory category, - const char* file, - int line) : - lock_(loggingStreamsMutex_, boost::defer_lock_t()), - level_(level), - stream_(&nullStream_), // By default, logging to "/dev/null" is simulated - category_(category), - file_(file), - line_(line) - { - Setup(category, NULL, file, line); - } - - InternalLogger::InternalLogger(LogLevel level, - LogCategory category, - const char* pluginName, - const char* file, - int line) : - lock_(loggingStreamsMutex_, boost::defer_lock_t()), - level_(level), - stream_(&nullStream_), // By default, logging to "/dev/null" is simulated - category_(category), - file_(file), - line_(line) - { - Setup(category, pluginName, file, line); - } - - - - InternalLogger::InternalLogger(LogLevel level, - const char* file, - int line) : - lock_(loggingStreamsMutex_, boost::defer_lock_t()), - level_(level), - stream_(&nullStream_), // By default, logging to "/dev/null" is simulated - category_(LogCategory_GENERIC), - file_(file), - line_(line) - { - Setup(LogCategory_GENERIC, NULL, file, line); - } - InternalLogger::~InternalLogger() {