diff OrthancFramework/Sources/Logging.h @ 4270:251a8b07fa37

logging categories
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 02 Nov 2020 18:45:50 +0100
parents c7bd2f21ccc3
children 1bd14c900699
line wrap: on
line diff
--- a/OrthancFramework/Sources/Logging.h	Mon Nov 02 17:15:57 2020 +0100
+++ b/OrthancFramework/Sources/Logging.h	Mon Nov 02 18:45:50 2020 +0100
@@ -52,11 +52,17 @@
       LogLevel_TRACE
     };
 
+    /**
+     * NB: The log level for each category is encoded as a bit
+     * mask. As a consequence, there can be up to 31 log categories
+     * (not 32, as the value GENERIC is reserved for the log commands
+     * that don't fall in a specific category).
+     **/
     enum LogCategory
     {
-      LogCategory_GENERIC,
-      LogCategory_SQLITE,
-      LogCategory_DICOM
+      LogCategory_GENERIC = (1 << 0),
+      LogCategory_SQLITE  = (1 << 1),
+      LogCategory_DICOM   = (1 << 2)
     };
     
     ORTHANC_PUBLIC const char* EnumerationToString(LogLevel level);
@@ -82,6 +88,15 @@
 
     ORTHANC_PUBLIC bool IsInfoLevelEnabled();
 
+    ORTHANC_PUBLIC void SetCategoryEnabled(LogLevel level,
+                                           LogCategory category,
+                                           bool enabled);
+
+    ORTHANC_PUBLIC bool IsCategoryEnabled(LogLevel level,
+                                          LogCategory category);
+    
+    ORTHANC_PUBLIC LogCategory StringToCategory(const std::string& category);
+
     ORTHANC_PUBLIC void SetTargetFile(const std::string& path);
 
     ORTHANC_PUBLIC void SetTargetFolder(const std::string& path);