Mercurial > hg > orthanc
comparison Core/Logging.cpp @ 2505:a4f885670da7
fix Windows build
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 26 Mar 2018 11:09:19 +0200 |
parents | 0188c21e417a |
children | 7133ad478eea |
comparison
equal
deleted
inserted
replaced
2504:78862372ea88 | 2505:a4f885670da7 |
---|---|
92 void Initialize(OrthancPluginContext* context) | 92 void Initialize(OrthancPluginContext* context) |
93 { | 93 { |
94 context_ = context; | 94 context_ = context; |
95 } | 95 } |
96 | 96 |
97 InternalLogger::InternalLogger(Level level, | 97 InternalLogger::InternalLogger(InternalLevel level, |
98 const char* file /* ignored */, | 98 const char* file /* ignored */, |
99 int line /* ignored */) : | 99 int line /* ignored */) : |
100 level_(level) | 100 level_(level) |
101 { | 101 { |
102 } | 102 } |
105 { | 105 { |
106 if (context_ != NULL) | 106 if (context_ != NULL) |
107 { | 107 { |
108 switch (level_) | 108 switch (level_) |
109 { | 109 { |
110 case ERROR: | 110 case InternalLevel_ERROR: |
111 OrthancPluginLogError(context_, message_.c_str()); | 111 OrthancPluginLogError(context_, message_.c_str()); |
112 break; | 112 break; |
113 | 113 |
114 case WARNING: | 114 case InternalLevel_WARNING: |
115 OrthancPluginLogWarning(context_, message_.c_str()); | 115 OrthancPluginLogWarning(context_, message_.c_str()); |
116 break; | 116 break; |
117 | 117 |
118 case INFO: | 118 case InternalLevel_INFO: |
119 OrthancPluginLogInfo(context_, message_.c_str()); | 119 OrthancPluginLogInfo(context_, message_.c_str()); |
120 break; | 120 break; |
121 | 121 |
122 case TRACE: | 122 case InternalLevel_TRACE: |
123 // Not used by plugins | 123 // Not used by plugins |
124 break; | 124 break; |
125 | 125 |
126 default: | 126 default: |
127 { | 127 { |
151 namespace Logging | 151 namespace Logging |
152 { | 152 { |
153 static bool globalVerbose_ = false; | 153 static bool globalVerbose_ = false; |
154 static bool globalTrace_ = false; | 154 static bool globalTrace_ = false; |
155 | 155 |
156 InternalLogger::InternalLogger(Level level, | 156 InternalLogger::InternalLogger(InternalLevel level, |
157 const char* file /* ignored */, | 157 const char* file /* ignored */, |
158 int line /* ignored */) : | 158 int line /* ignored */) : |
159 level_(level) | 159 level_(level) |
160 { | 160 { |
161 } | 161 } |
162 | 162 |
163 InternalLogger::~InternalLogger() | 163 InternalLogger::~InternalLogger() |
164 { | 164 { |
165 switch (level_) | 165 switch (level_) |
166 { | 166 { |
167 case ERROR: | 167 case InternalLevel_ERROR: |
168 fprintf(stderr, "E: %s\n", message_.c_str()); | 168 fprintf(stderr, "E: %s\n", message_.c_str()); |
169 break; | 169 break; |
170 | 170 |
171 case WARNING: | 171 case InternalLevel_WARNING: |
172 fprintf(stdout, "W: %s\n", message_.c_str()); | 172 fprintf(stdout, "W: %s\n", message_.c_str()); |
173 break; | 173 break; |
174 | 174 |
175 case INFO: | 175 case InternalLevel_INFO: |
176 if (globalVerbose_) | 176 if (globalVerbose_) |
177 { | 177 { |
178 fprintf(stdout, "I: %s\n", message_.c_str()); | 178 fprintf(stdout, "I: %s\n", message_.c_str()); |
179 } | 179 } |
180 break; | 180 break; |
181 | 181 |
182 case TRACE: | 182 case InternalLevel_TRACE: |
183 if (globalTrace_) | 183 if (globalTrace_) |
184 { | 184 { |
185 fprintf(stdout, "T: %s\n", message_.c_str()); | 185 fprintf(stdout, "T: %s\n", message_.c_str()); |
186 } | 186 } |
187 break; | 187 break; |