comparison OrthancServer/Plugins/Engine/PluginsManager.cpp @ 5561:0b18690c1935

SDK: added OrthancPluginLogMessage to display plugin name + file and line from plugin
author Alain Mazy <am@orthanc.team>
date Tue, 23 Apr 2024 09:34:02 +0200
parents 48b8dae6dc77
children addccb1590d2
comparison
equal deleted inserted replaced
5560:c80dbbae3f60 5561:0b18690c1935
159 159
160 case _OrthancPluginService_LogInfo: 160 case _OrthancPluginService_LogInfo:
161 CLOG(INFO, PLUGINS) << reinterpret_cast<const char*>(params); 161 CLOG(INFO, PLUGINS) << reinterpret_cast<const char*>(params);
162 return OrthancPluginErrorCode_Success; 162 return OrthancPluginErrorCode_Success;
163 163
164 case _OrthancPluginService_LogMessage:
165 {
166 const _OrthancPluginLogMessage& m = *reinterpret_cast<const _OrthancPluginLogMessage*>(params);
167 // we may convert directly from OrthancPluginLogLevel to LogLevel (and category) because the enum values must be identical
168 // for Orthanc::Logging to work both in the core and in the plugins
169 Orthanc::Logging::LogLevel level = static_cast<Orthanc::Logging::LogLevel>(m.level);
170 Orthanc::Logging::LogCategory category = static_cast<Orthanc::Logging::LogCategory>(m.category);
171
172 LOG_FROM_PLUGIN(level, category, m.plugin, m.file, m.line) << m.message;
173 return OrthancPluginErrorCode_Success;
174 };
175
164 default: 176 default:
165 break; 177 break;
166 } 178 }
167 179
168 Plugin* that = reinterpret_cast<Plugin*>(context->pluginsManager); 180 Plugin* that = reinterpret_cast<Plugin*>(context->pluginsManager);