comparison Core/Logging.h @ 3995:1f405a3fdeca

reorganizing Logging
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 05 Jun 2020 18:08:17 +0200
parents 7e8bfda62b43
children c2b9a7a1c74a
comparison
equal deleted inserted replaced
3993:7e8bfda62b43 3995:1f405a3fdeca
56 # else 56 # else
57 # define ORTHANC_ENABLE_LOGGING_STDIO 0 57 # define ORTHANC_ENABLE_LOGGING_STDIO 0
58 # endif 58 # endif
59 #endif 59 #endif
60 60
61 #if ORTHANC_ENABLE_LOGGING_PLUGIN == 1
62 # include <orthanc/OrthancCPlugin.h>
63 #endif
64
65 #include <boost/lexical_cast.hpp> 61 #include <boost/lexical_cast.hpp>
66 62
67 namespace Orthanc 63 namespace Orthanc
68 { 64 {
69 namespace Logging 65 namespace Logging
70 { 66 {
71 #if ORTHANC_ENABLE_LOGGING_PLUGIN == 1 67 #if ORTHANC_ENABLE_LOGGING_PLUGIN == 1
72 ORTHANC_PUBLIC void Initialize(OrthancPluginContext* context); 68 // "pluginContext" must be of type "OrthancPluginContext"
69 ORTHANC_PUBLIC void Initialize(void* pluginContext);
73 #else 70 #else
74 ORTHANC_PUBLIC void Initialize(); 71 ORTHANC_PUBLIC void Initialize();
75 #endif 72 #endif
76 73
77 ORTHANC_PUBLIC void Finalize(); 74 ORTHANC_PUBLIC void Finalize();
92 89
93 ORTHANC_PUBLIC void SetTargetFolder(const std::string& path); 90 ORTHANC_PUBLIC void SetTargetFolder(const std::string& path);
94 91
95 #if ORTHANC_ENABLE_LOGGING_STDIO == 1 92 #if ORTHANC_ENABLE_LOGGING_STDIO == 1
96 typedef void (*LoggingFunction)(const char*); 93 typedef void (*LoggingFunction)(const char*);
97 void SetErrorWarnInfoTraceLoggingFunctions( 94 ORTHANC_PUBLIC void SetErrorWarnInfoTraceLoggingFunctions(LoggingFunction errorLogFunc,
98 LoggingFunction errorLogFunc, 95 LoggingFunction warningLogfunc,
99 LoggingFunction warningLogfunc, 96 LoggingFunction infoLogFunc,
100 LoggingFunction infoLogFunc, 97 LoggingFunction traceLogFunc);
101 LoggingFunction traceLogFunc); 98 #endif
102 #endif
103
104 99
105 struct NullStream : public std::ostream 100 struct NullStream : public std::ostream
106 { 101 {
107 NullStream() : 102 NullStream() :
108 std::ios(0), 103 std::ios(0),
176 ORTHANC_ENABLE_LOGGING == 1 */ 171 ORTHANC_ENABLE_LOGGING == 1 */
177 172
178 # include <boost/thread/mutex.hpp> 173 # include <boost/thread/mutex.hpp>
179 # define LOG(level) ::Orthanc::Logging::InternalLogger(#level, __FILE__, __LINE__) 174 # define LOG(level) ::Orthanc::Logging::InternalLogger(#level, __FILE__, __LINE__)
180 # define VLOG(level) ::Orthanc::Logging::InternalLogger("TRACE", __FILE__, __LINE__) 175 # define VLOG(level) ::Orthanc::Logging::InternalLogger("TRACE", __FILE__, __LINE__)
176
181 177
182 namespace Orthanc 178 namespace Orthanc
183 { 179 {
184 namespace Logging 180 namespace Logging
185 { 181 {