diff Samples/Common/SampleHelpers.h @ 1383:ab871499ed30

SingleFrameViewer: refactored file locations + names to share files for RtViewer
author Benjamin Golinvaux <bgo@osimis.io>
date Mon, 27 Apr 2020 10:01:03 +0200
parents Samples/CommonHelpers.h@9d138883be66
children dfb48f0794b1
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Samples/Common/SampleHelpers.h	Mon Apr 27 10:01:03 2020 +0200
@@ -0,0 +1,35 @@
+#pragma once
+
+#include <string>
+#include <iostream>
+
+#include <Core/Logging.h>
+
+namespace OrthancStoneHelpers
+{
+  inline void SetLogLevel(std::string logLevel)
+  {
+    boost::to_lower(logLevel);
+    if (logLevel == "warning")
+    {
+      Orthanc::Logging::EnableInfoLevel(false);
+      Orthanc::Logging::EnableTraceLevel(false);
+    }
+    else if (logLevel == "info")
+    {
+      Orthanc::Logging::EnableInfoLevel(true);
+      Orthanc::Logging::EnableTraceLevel(false);
+    }
+    else if (logLevel == "trace")
+    {
+      Orthanc::Logging::EnableInfoLevel(true);
+      Orthanc::Logging::EnableTraceLevel(true);
+    }
+    else
+    {
+      std::cerr << "Unknown log level \"" << logLevel << "\". Will use TRACE as default!";
+      Orthanc::Logging::EnableInfoLevel(true);
+      Orthanc::Logging::EnableTraceLevel(true);
+    }
+  }
+}
\ No newline at end of file