comparison OrthancFramework/Sources/Logging.h @ 5571:addccb1590d2

simplifying Orthanc::Logging
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 26 Apr 2024 14:48:11 +0200
parents 0b18690c1935
children d7eaa568da15
comparison
equal deleted inserted replaced
5570:cc4b7b4d5deb 5571:addccb1590d2
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