diff Common/StoragePlugin.cpp @ 151:00cd1f01dd5d

fix initialization and finalization
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 21 Jun 2024 10:29:52 +0200
parents 3c7e0374f28e
children d62f52be1943
line wrap: on
line diff
--- a/Common/StoragePlugin.cpp	Thu Jun 20 21:58:54 2024 +0200
+++ b/Common/StoragePlugin.cpp	Fri Jun 21 10:29:52 2024 +0200
@@ -530,13 +530,13 @@
   {
     OrthancPlugins::SetGlobalContext(context);
 
-    Orthanc::InitializeFramework("", false);
+#if ORTHANC_FRAMEWORK_VERSION_IS_ABOVE(1, 12, 4)
+    Orthanc::Logging::InitializePluginContext(context, StoragePluginFactory::GetStoragePluginName());
+#elif ORTHANC_FRAMEWORK_VERSION_IS_ABOVE(1, 7, 2)
     Orthanc::Logging::InitializePluginContext(context);
-
-    OrthancPlugins::OrthancConfiguration orthancConfig;
-
-    OrthancPlugins::LogWarning(std::string(StoragePluginFactory::GetStoragePluginName()) + " plugin is initializing");
-    OrthancPlugins::SetDescription(StoragePluginFactory::GetStoragePluginName(), StoragePluginFactory::GetStorageDescription());
+#else
+    Orthanc::Logging::Initialize(context);
+#endif
 
     /* Check the version of the Orthanc core */
     if (OrthancPluginCheckVersion(context) == 0)
@@ -551,6 +551,13 @@
       return -1;
     }
 
+    Orthanc::InitializeFramework("", false);
+
+    OrthancPlugins::OrthancConfiguration orthancConfig;
+
+    OrthancPlugins::LogWarning(std::string(StoragePluginFactory::GetStoragePluginName()) + " plugin is initializing");
+    OrthancPlugins::SetDescription(StoragePluginFactory::GetStoragePluginName(), StoragePluginFactory::GetStorageDescription());
+
     try
     {
       const char* pluginSectionName = StoragePluginFactory::GetConfigurationSectionName();