comparison OrthancFramework/Sources/Logging.h @ 5577:9e74e761b108 find-refactoring

integration mainline->find-refactoring
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 26 Apr 2024 17:43:22 +0200
parents d7eaa568da15
children 4bd7abdfb9cf
comparison
equal deleted inserted replaced
5574:5a13483d12c5 5577:9e74e761b108
78 ORTHANC_PUBLIC LogLevel StringToLogLevel(const char* level); 78 ORTHANC_PUBLIC LogLevel StringToLogLevel(const char* level);
79 79
80 // "pluginContext" must be of type "OrthancPluginContext" 80 // "pluginContext" must be of type "OrthancPluginContext"
81 ORTHANC_PUBLIC void InitializePluginContext(void* pluginContext); 81 ORTHANC_PUBLIC void InitializePluginContext(void* pluginContext);
82 82
83 // note: this variant shall be called only from a plugin and only if ORTHANC_FRAMEWORK_VERSION_IS_ABOVE(1, 12, 4) && ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 4) 83 ORTHANC_PUBLIC void InitializePluginContext(void* pluginContext,
84 ORTHANC_PUBLIC void InitializePluginContext(void* pluginContext, const char* pluginName); 84 const std::string& pluginName);
85 85
86 ORTHANC_PUBLIC void Initialize(); 86 ORTHANC_PUBLIC void Initialize();
87 87
88 ORTHANC_PUBLIC void Finalize(); 88 ORTHANC_PUBLIC void Finalize();
89 89
179 # define __ORTHANC_FILE__ __FILE__ 179 # define __ORTHANC_FILE__ __FILE__
180 #endif 180 #endif
181 181
182 # define LOG(level) ::Orthanc::Logging::InternalLogger \ 182 # define LOG(level) ::Orthanc::Logging::InternalLogger \
183 (::Orthanc::Logging::LogLevel_ ## level, \ 183 (::Orthanc::Logging::LogLevel_ ## level, \
184 ::Orthanc::Logging::LogCategory_GENERIC, __ORTHANC_FILE__, __LINE__) 184 ::Orthanc::Logging::LogCategory_GENERIC, NULL /* no plugin */, \
185 __ORTHANC_FILE__, __LINE__)
186
185 # define VLOG(unused) ::Orthanc::Logging::InternalLogger \ 187 # define VLOG(unused) ::Orthanc::Logging::InternalLogger \
186 (::Orthanc::Logging::LogLevel_TRACE, \ 188 (::Orthanc::Logging::LogLevel_TRACE, \
187 ::Orthanc::Logging::LogCategory_GENERIC, __ORTHANC_FILE__, __LINE__) 189 ::Orthanc::Logging::LogCategory_GENERIC, NULL /* no plugin */, \
190 __ORTHANC_FILE__, __LINE__)
191
188 # define CLOG(level, category) ::Orthanc::Logging::InternalLogger \ 192 # define CLOG(level, category) ::Orthanc::Logging::InternalLogger \
189 (::Orthanc::Logging::LogLevel_ ## level, \ 193 (::Orthanc::Logging::LogLevel_ ## level, \
190 ::Orthanc::Logging::LogCategory_ ## category, __ORTHANC_FILE__, __LINE__) 194 ::Orthanc::Logging::LogCategory_ ## category, NULL /* no plugin */, \
191 # define LOG_FROM_PLUGIN(level, category, pluginName, file, line) ::Orthanc::Logging::InternalLogger \ 195 __ORTHANC_FILE__, __LINE__)
192 (level, category, pluginName, file, line) 196
197 # define LOG_FROM_PLUGIN(level, category, pluginName, file, line) \
198 ::Orthanc::Logging::InternalLogger(level, category, pluginName, file, line)
199
193 #endif 200 #endif
194 201
195 202
196 203
197 #if (ORTHANC_ENABLE_LOGGING == 1 && \ 204 #if (ORTHANC_ENABLE_LOGGING == 1 && \
268 std::ostream* stream_; 275 std::ostream* stream_;
269 LogCategory category_; 276 LogCategory category_;
270 const char* file_; 277 const char* file_;
271 uint32_t line_; 278 uint32_t line_;
272 279
273 void Setup(LogCategory category,
274 const char* pluginName,
275 const char* file,
276 int line);
277
278 public: 280 public:
279 InternalLogger(LogLevel level, 281 InternalLogger(LogLevel level,
280 LogCategory category, 282 LogCategory category,
281 const char* file,
282 int line);
283
284 InternalLogger(LogLevel level,
285 LogCategory category,
286 const char* pluginName, 283 const char* pluginName,
287 const char* file,
288 int line);
289
290 // For backward binary compatibility with Orthanc Framework <= 1.8.0
291 InternalLogger(LogLevel level,
292 const char* file, 284 const char* file,
293 int line); 285 int line);
294 286
295 ~InternalLogger(); 287 ~InternalLogger();
296 288