comparison OrthancFramework/Sources/Logging.cpp @ 4271:1bd14c900699

LogCategory_PLUGINS
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 03 Nov 2020 07:15:44 +0100
parents 251a8b07fa37
children 1661544ea94d
comparison
equal deleted inserted replaced
4270:251a8b07fa37 4271:1bd14c900699
130 130
131 void SetCategoryEnabled(LogLevel level, 131 void SetCategoryEnabled(LogLevel level,
132 LogCategory category, 132 LogCategory category,
133 bool enabled) 133 bool enabled)
134 { 134 {
135 // Invariant: If a bit is set for "trace", it must also be set
136 // for "verbose" (in other words, trace level implies verbose level)
137 assert((traceCategoriesMask_ & infoCategoriesMask_) == traceCategoriesMask_);
138
135 if (level == LogLevel_INFO) 139 if (level == LogLevel_INFO)
136 { 140 {
137 if (enabled) 141 if (enabled)
138 { 142 {
139 infoCategoriesMask_ |= static_cast<uint32_t>(category); 143 infoCategoriesMask_ |= static_cast<uint32_t>(category);
159 else 163 else
160 { 164 {
161 throw OrthancException(ErrorCode_ParameterOutOfRange, 165 throw OrthancException(ErrorCode_ParameterOutOfRange,
162 "Can only modify the parameters of the INFO and TRACE levels"); 166 "Can only modify the parameters of the INFO and TRACE levels");
163 } 167 }
168
169 assert((traceCategoriesMask_ & infoCategoriesMask_) == traceCategoriesMask_);
164 } 170 }
165 171
166 172
167 bool IsCategoryEnabled(LogLevel level, 173 bool IsCategoryEnabled(LogLevel level,
168 LogCategory category) 174 LogCategory category)
190 LogCategory StringToCategory(const std::string& category) 196 LogCategory StringToCategory(const std::string& category)
191 { 197 {
192 if (category == "generic") 198 if (category == "generic")
193 { 199 {
194 return LogCategory_GENERIC; 200 return LogCategory_GENERIC;
201 }
202 else if (category == "plugins")
203 {
204 return LogCategory_PLUGINS;
195 } 205 }
196 else if (category == "dicom") 206 else if (category == "dicom")
197 { 207 {
198 return LogCategory_DICOM; 208 return LogCategory_DICOM;
199 } 209 }