diff Sources/PythonLock.cpp @ 28:b2bbb516056e

The "Calling Python..." info logs are disabled if "PythonVerbose" is "false"
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 27 Apr 2020 07:59:35 +0200
parents 952e969a2240
children fd58eb5749ed
line wrap: on
line diff
--- a/Sources/PythonLock.cpp	Tue Apr 07 07:52:07 2020 +0200
+++ b/Sources/PythonLock.cpp	Mon Apr 27 07:59:35 2020 +0200
@@ -32,6 +32,7 @@
 static PythonLock::ModuleClassesInstaller  moduleClasses_ = NULL;
 static std::string  moduleName_;
 static std::string  exceptionName_;
+static bool verbose_ = false;
 
 
 struct module_state 
@@ -345,6 +346,7 @@
 
   Py_InspectFlag = 1;   // Don't exit the Orthanc process on Python error
 
+  verbose_ = verbose;
   if (verbose)
   {
     Py_VerboseFlag = 1;
@@ -469,3 +471,18 @@
     }
   }
 }
+
+
+void PythonLock::LogCall(const std::string& message)
+{
+  /**
+   * For purity, this function should lock the global "mutex_", but
+   * "verbose_" cannot change after the initial call to
+   * "GlobalInitialize()".
+   **/
+  
+  if (verbose_)
+  {
+    OrthancPlugins::LogInfo(message);
+  }
+}