comparison OrthancServer/Plugins/Samples/MultitenantDicom/Plugin.cpp @ 5563:e02cdf358905

fix plugin init wrt logging
author Alain Mazy <am@orthanc.team>
date Tue, 23 Apr 2024 10:26:48 +0200
parents 0b18690c1935
children f7adfb22e20e
comparison
equal deleted inserted replaced
5561:0b18690c1935 5563:e02cdf358905
119 extern "C" 119 extern "C"
120 { 120 {
121 ORTHANC_PLUGINS_API int32_t OrthancPluginInitialize(OrthancPluginContext* context) 121 ORTHANC_PLUGINS_API int32_t OrthancPluginInitialize(OrthancPluginContext* context)
122 { 122 {
123 OrthancPlugins::SetGlobalContext(context, ORTHANC_PLUGIN_NAME); 123 OrthancPlugins::SetGlobalContext(context, ORTHANC_PLUGIN_NAME);
124 Orthanc::Logging::InitializePluginContext(context, ORTHANC_PLUGIN_NAME);
124 125
125 /* Check the version of the Orthanc core */ 126 /* Check the version of the Orthanc core */
126 if (OrthancPluginCheckVersion(OrthancPlugins::GetGlobalContext()) == 0) 127 if (OrthancPluginCheckVersion(OrthancPlugins::GetGlobalContext()) == 0)
127 { 128 {
128 char info[1024]; 129 char info[1024];
133 ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER); 134 ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER);
134 OrthancPluginLogError(OrthancPlugins::GetGlobalContext(), info); 135 OrthancPluginLogError(OrthancPlugins::GetGlobalContext(), info);
135 return -1; 136 return -1;
136 } 137 }
137 138
138 #if ORTHANC_FRAMEWORK_VERSION_IS_ABOVE(1, 7, 2)
139 Orthanc::Logging::InitializePluginContext(context);
140 #else
141 Orthanc::Logging::Initialize(context);
142 #endif
143
144 if (!OrthancPlugins::CheckMinimalOrthancVersion(1, 12, 4))
145 {
146 OrthancPlugins::ReportMinimalOrthancVersion(1, 12, 4);
147 return -1;
148 }
149
150 OrthancPluginSetDescription2(context, ORTHANC_PLUGIN_NAME, "Multitenant plugin for Orthanc."); 139 OrthancPluginSetDescription2(context, ORTHANC_PLUGIN_NAME, "Multitenant plugin for Orthanc.");
151 140
152 OrthancPluginRegisterOnChangeCallback(context, OnChangeCallback); 141 OrthancPluginRegisterOnChangeCallback(context, OnChangeCallback);
153 142
154 try 143 try