comparison OrthancFramework/Sources/Logging.cpp @ 4268:0ae2ca210077

new macro TLOG() to replace VLOG() for trace logs with a category
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 02 Nov 2020 14:48:15 +0100
parents bf7b9edf6b81
children c7bd2f21ccc3
comparison
equal deleted inserted replaced
4267:a20928107a90 4268:0ae2ca210077
219 // TODO: stone_console_info(message_.c_str()); 219 // TODO: stone_console_info(message_.c_str());
220 } 220 }
221 break; 221 break;
222 222
223 case LogLevel_TRACE: 223 case LogLevel_TRACE:
224 // TODO - Check trace category
224 if (traceEnabled_) 225 if (traceEnabled_)
225 { 226 {
226 TraceLogFunc(message.c_str()); 227 TraceLogFunc(message.c_str());
227 } 228 }
228 break; 229 break;
641 } 642 }
642 } 643 }
643 644
644 645
645 InternalLogger::InternalLogger(LogLevel level, 646 InternalLogger::InternalLogger(LogLevel level,
647 TraceCategory category,
646 const char* file, 648 const char* file,
647 int line) : 649 int line) :
648 lock_(loggingStreamsMutex_, boost::defer_lock_t()), 650 lock_(loggingStreamsMutex_, boost::defer_lock_t()),
649 level_(level), 651 level_(level),
652 category_(category),
650 stream_(&nullStream_) // By default, logging to "/dev/null" is simulated 653 stream_(&nullStream_) // By default, logging to "/dev/null" is simulated
651 { 654 {
652 if (pluginContext_ != NULL) 655 if (pluginContext_ != NULL)
653 { 656 {
654 // We are logging using the Orthanc plugin SDK 657 // We are logging using the Orthanc plugin SDK
668 else 671 else
669 { 672 {
670 // We are logging in a standalone application, not inside an Orthanc plugin 673 // We are logging in a standalone application, not inside an Orthanc plugin
671 674
672 if ((level == LogLevel_INFO && !infoEnabled_) || 675 if ((level == LogLevel_INFO && !infoEnabled_) ||
673 (level == LogLevel_TRACE && !traceEnabled_)) 676 (level == LogLevel_TRACE && !traceEnabled_)) // TODO - Check trace category
674 { 677 {
675 // This logging level is disabled, directly exit as the 678 // This logging level is disabled, directly exit as the
676 // stream is set to "/dev/null" 679 // stream is set to "/dev/null"
677 return; 680 return;
678 } 681 }