Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/corelib/io/qloggingregistry.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||
2 | - | |||||||||||||||||||
3 | - | |||||||||||||||||||
4 | - | |||||||||||||||||||
5 | - | |||||||||||||||||||
6 | - | |||||||||||||||||||
7 | - | |||||||||||||||||||
8 | - | |||||||||||||||||||
9 | - | |||||||||||||||||||
10 | - | |||||||||||||||||||
11 | namespace { namespace Q_QGS_qtLoggingRegistry { typedef QLoggingRegistry Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized) guard.store(QtGlobalStatic::Destroyed); } }; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type ())) : value () { guard.store(QtGlobalStatic::Initialized); } } holder; return &holder.value; } } } static QGlobalStatic<QLoggingRegistry, Q_QGS_qtLoggingRegistry::innerFunction, Q_QGS_qtLoggingRegistry::guard> qtLoggingRegistry; | - | ||||||||||||||||||
12 | - | |||||||||||||||||||
13 | - | |||||||||||||||||||
14 | - | |||||||||||||||||||
15 | - | |||||||||||||||||||
16 | - | |||||||||||||||||||
17 | QLoggingRule::QLoggingRule() : | - | ||||||||||||||||||
18 | enabled(false) | - | ||||||||||||||||||
19 | { | - | ||||||||||||||||||
20 | } | - | ||||||||||||||||||
21 | - | |||||||||||||||||||
22 | - | |||||||||||||||||||
23 | - | |||||||||||||||||||
24 | - | |||||||||||||||||||
25 | - | |||||||||||||||||||
26 | QLoggingRule::QLoggingRule(const QStringRef &pattern, bool enabled) : | - | ||||||||||||||||||
27 | messageType(-1), | - | ||||||||||||||||||
28 | enabled(enabled) | - | ||||||||||||||||||
29 | { | - | ||||||||||||||||||
30 | parse(pattern); | - | ||||||||||||||||||
31 | } | - | ||||||||||||||||||
32 | - | |||||||||||||||||||
33 | - | |||||||||||||||||||
34 | - | |||||||||||||||||||
35 | - | |||||||||||||||||||
36 | - | |||||||||||||||||||
37 | - | |||||||||||||||||||
38 | int QLoggingRule::pass(const QString &cat, QtMsgType msgType) const | - | ||||||||||||||||||
39 | { | - | ||||||||||||||||||
40 | - | |||||||||||||||||||
41 | if (messageType > -1 && messageType != msgType) | - | ||||||||||||||||||
42 | return 0; | - | ||||||||||||||||||
43 | - | |||||||||||||||||||
44 | if (flags == FullText) { | - | ||||||||||||||||||
45 | - | |||||||||||||||||||
46 | if (category == cat) | - | ||||||||||||||||||
47 | return (enabled ? 1 : -1); | - | ||||||||||||||||||
48 | else | - | ||||||||||||||||||
49 | return 0; | - | ||||||||||||||||||
50 | } | - | ||||||||||||||||||
51 | - | |||||||||||||||||||
52 | const int idx = cat.indexOf(category); | - | ||||||||||||||||||
53 | if (idx >= 0) { | - | ||||||||||||||||||
54 | if (flags == MidFilter) { | - | ||||||||||||||||||
55 | - | |||||||||||||||||||
56 | if (idx >= 0) | - | ||||||||||||||||||
57 | return (enabled ? 1 : -1); | - | ||||||||||||||||||
58 | } else if (flags == LeftFilter) { | - | ||||||||||||||||||
59 | - | |||||||||||||||||||
60 | if (idx == 0) | - | ||||||||||||||||||
61 | return (enabled ? 1 : -1); | - | ||||||||||||||||||
62 | } else if (flags == RightFilter) { | - | ||||||||||||||||||
63 | - | |||||||||||||||||||
64 | if (idx == (cat.count() - category.count())) | - | ||||||||||||||||||
65 | return (enabled ? 1 : -1); | - | ||||||||||||||||||
66 | } | - | ||||||||||||||||||
67 | } | - | ||||||||||||||||||
68 | return 0; | - | ||||||||||||||||||
69 | } | - | ||||||||||||||||||
70 | void QLoggingRule::parse(const QStringRef &pattern) | - | ||||||||||||||||||
71 | { | - | ||||||||||||||||||
72 | QStringRef p; | - | ||||||||||||||||||
73 | - | |||||||||||||||||||
74 | - | |||||||||||||||||||
75 | if (pattern.endsWith(QLatin1String(".debug"))) { | - | ||||||||||||||||||
76 | p = QStringRef(pattern.string(), pattern.position(), | - | ||||||||||||||||||
77 | pattern.length() - 6); | - | ||||||||||||||||||
78 | messageType = QtDebugMsg; | - | ||||||||||||||||||
79 | } else if (pattern.endsWith(QLatin1String(".info"))) { | - | ||||||||||||||||||
80 | p = QStringRef(pattern.string(), pattern.position(), | - | ||||||||||||||||||
81 | pattern.length() - 5); | - | ||||||||||||||||||
82 | messageType = QtInfoMsg; | - | ||||||||||||||||||
83 | } else if (pattern.endsWith(QLatin1String(".warning"))) { | - | ||||||||||||||||||
84 | p = QStringRef(pattern.string(), pattern.position(), | - | ||||||||||||||||||
85 | pattern.length() - 8); | - | ||||||||||||||||||
86 | messageType = QtWarningMsg; | - | ||||||||||||||||||
87 | } else if (pattern.endsWith(QLatin1String(".critical"))) { | - | ||||||||||||||||||
88 | p = QStringRef(pattern.string(), pattern.position(), | - | ||||||||||||||||||
89 | pattern.length() - 9); | - | ||||||||||||||||||
90 | messageType = QtCriticalMsg; | - | ||||||||||||||||||
91 | } else { | - | ||||||||||||||||||
92 | p = pattern; | - | ||||||||||||||||||
93 | } | - | ||||||||||||||||||
94 | - | |||||||||||||||||||
95 | if (!p.contains(QLatin1Char('*'))) { | - | ||||||||||||||||||
96 | flags = FullText; | - | ||||||||||||||||||
97 | } else { | - | ||||||||||||||||||
98 | if (p.endsWith(QLatin1Char('*'))) { | - | ||||||||||||||||||
99 | flags |= LeftFilter; | - | ||||||||||||||||||
100 | p = QStringRef(p.string(), p.position(), p.length() - 1); | - | ||||||||||||||||||
101 | } | - | ||||||||||||||||||
102 | if (p.startsWith(QLatin1Char('*'))) { | - | ||||||||||||||||||
103 | flags |= RightFilter; | - | ||||||||||||||||||
104 | p = QStringRef(p.string(), p.position() + 1, p.length() - 1); | - | ||||||||||||||||||
105 | } | - | ||||||||||||||||||
106 | if (p.contains(QLatin1Char('*'))) | - | ||||||||||||||||||
107 | flags = 0; | - | ||||||||||||||||||
108 | } | - | ||||||||||||||||||
109 | - | |||||||||||||||||||
110 | category = p.toString(); | - | ||||||||||||||||||
111 | } | - | ||||||||||||||||||
112 | void QLoggingSettingsParser::setContent(const QString &content) | - | ||||||||||||||||||
113 | { | - | ||||||||||||||||||
114 | QString content_ = content; | - | ||||||||||||||||||
115 | QTextStream stream(&content_, QIODevice::ReadOnly); | - | ||||||||||||||||||
116 | setContent(stream); | - | ||||||||||||||||||
117 | } | - | ||||||||||||||||||
118 | - | |||||||||||||||||||
119 | - | |||||||||||||||||||
120 | - | |||||||||||||||||||
121 | - | |||||||||||||||||||
122 | - | |||||||||||||||||||
123 | void QLoggingSettingsParser::setContent(QTextStream &stream) | - | ||||||||||||||||||
124 | { | - | ||||||||||||||||||
125 | _rules.clear(); | - | ||||||||||||||||||
126 | while (!stream.atEnd()) { | - | ||||||||||||||||||
127 | QString line = stream.readLine(); | - | ||||||||||||||||||
128 | - | |||||||||||||||||||
129 | - | |||||||||||||||||||
130 | line = line.simplified(); | - | ||||||||||||||||||
131 | line.remove(QLatin1Char(' ')); | - | ||||||||||||||||||
132 | - | |||||||||||||||||||
133 | - | |||||||||||||||||||
134 | if (line.startsWith(QLatin1Char(';'))) | - | ||||||||||||||||||
135 | continue; | - | ||||||||||||||||||
136 | - | |||||||||||||||||||
137 | if (line.startsWith(QLatin1Char('[')) && line.endsWith(QLatin1Char(']'))) { | - | ||||||||||||||||||
138 | - | |||||||||||||||||||
139 | _section = line.mid(1, line.size() - 2); | - | ||||||||||||||||||
140 | continue; | - | ||||||||||||||||||
141 | } | - | ||||||||||||||||||
142 | - | |||||||||||||||||||
143 | if (_section.toLower() == QLatin1String("rules")) { | - | ||||||||||||||||||
144 | int equalPos = line.indexOf(QLatin1Char('=')); | - | ||||||||||||||||||
145 | if (equalPos != -1) { | - | ||||||||||||||||||
146 | if (line.lastIndexOf(QLatin1Char('=')) == equalPos) { | - | ||||||||||||||||||
147 | const QStringRef pattern = line.leftRef(equalPos); | - | ||||||||||||||||||
148 | const QStringRef valueStr = line.midRef(equalPos + 1); | - | ||||||||||||||||||
149 | int value = -1; | - | ||||||||||||||||||
150 | if (valueStr == QLatin1String("true")) | - | ||||||||||||||||||
151 | value = 1; | - | ||||||||||||||||||
152 | else if (valueStr == QLatin1String("false")) | - | ||||||||||||||||||
153 | value = 0; | - | ||||||||||||||||||
154 | QLoggingRule rule(pattern, (value == 1)); | - | ||||||||||||||||||
155 | if (rule.flags != 0 && (value != -1)) | - | ||||||||||||||||||
156 | _rules.append(rule); | - | ||||||||||||||||||
157 | else | - | ||||||||||||||||||
158 | QMessageLogger(__FILE__, 227233, __FUNCTION__, "qt.core.logging").warning("Ignoring malformed logging rule: '%s'", line.toUtf8().constData()); | - | ||||||||||||||||||
159 | } else { | - | ||||||||||||||||||
160 | QMessageLogger(__FILE__, 229235, __FUNCTION__, "qt.core.logging").warning("Ignoring malformed logging rule: '%s'", line.toUtf8().constData()); | - | ||||||||||||||||||
161 | } | - | ||||||||||||||||||
162 | } | - | ||||||||||||||||||
163 | } | - | ||||||||||||||||||
164 | } | - | ||||||||||||||||||
165 | } | - | ||||||||||||||||||
166 | - | |||||||||||||||||||
167 | - | |||||||||||||||||||
168 | - | |||||||||||||||||||
169 | - | |||||||||||||||||||
170 | - | |||||||||||||||||||
171 | QLoggingRegistry::QLoggingRegistry() | - | ||||||||||||||||||
172 | : categoryFilter(defaultCategoryFilter) | - | ||||||||||||||||||
173 | { | - | ||||||||||||||||||
174 | } | - | ||||||||||||||||||
175 | - | |||||||||||||||||||
176 | static bool qtLoggingDebug() | - | ||||||||||||||||||
177 | { | - | ||||||||||||||||||
178 | static const bool debugEnv = qEnvironmentVariableIsSet("QT_LOGGING_DEBUG"); | - | ||||||||||||||||||
179 | return debugEnv; | - | ||||||||||||||||||
180 | } | - | ||||||||||||||||||
181 | - | |||||||||||||||||||
182 | static QVector<QLoggingRule> loadRulesFromFile(const QString &filePath) | - | ||||||||||||||||||
183 | { | - | ||||||||||||||||||
184 | QFile file(filePath); | - | ||||||||||||||||||
185 | if (file.open(QIODevice::ReadOnly | QIODevice::Text)) { | - | ||||||||||||||||||
186 | if (qtLoggingDebug()) | - | ||||||||||||||||||
187 | QMessageLogger(__FILE__, 256262, __FUNCTION__, "qt.core.logging").debug("Loading \"%s\" ...", | - | ||||||||||||||||||
188 | QDir::toNativeSeparators(file.fileName()).toUtf8().constData()); | - | ||||||||||||||||||
189 | QTextStream stream(&file); | - | ||||||||||||||||||
190 | QLoggingSettingsParser parser; | - | ||||||||||||||||||
191 | parser.setContent(stream); | - | ||||||||||||||||||
192 | return parser.rules(); | - | ||||||||||||||||||
193 | } | - | ||||||||||||||||||
194 | return QVector<QLoggingRule>(); | - | ||||||||||||||||||
195 | } | - | ||||||||||||||||||
196 | - | |||||||||||||||||||
197 | - | |||||||||||||||||||
198 | - | |||||||||||||||||||
199 | - | |||||||||||||||||||
200 | - | |||||||||||||||||||
201 | - | |||||||||||||||||||
202 | void QLoggingRegistry::init() | - | ||||||||||||||||||
203 | { | - | ||||||||||||||||||
204 | - | |||||||||||||||||||
205 | QVector<QLoggingRule> er, qr, cr;const QByteArray rulesFilePath = qgetenv("QT_LOGGING_CONF"); | - | ||||||||||||||||||
206 | if (!rulesFilePath.isEmpty()
| 3-1078 | ||||||||||||||||||
207 | erenvRules executed 3 times by 1 test: = loadRulesFromFile(QFile::decodeName(rulesFilePath));envRules = loadRulesFromFile(QFile::decodeName(rulesFilePath)); Executed by:
executed 3 times by 1 test: envRules = loadRulesFromFile(QFile::decodeName(rulesFilePath)); Executed by:
| 3 | ||||||||||||||||||
208 | - | |||||||||||||||||||
209 | const QByteArray rulesSrc = qgetenv("QT_LOGGING_RULES").replace(';', '\n'); | - | ||||||||||||||||||
210 | if (!rulesSrc.isEmpty()
| 2-1079 | ||||||||||||||||||
211 | QTextStream stream(rulesSrc); | - | ||||||||||||||||||
212 | QLoggingSettingsParser parser; | - | ||||||||||||||||||
213 | parser.setSection(([]() -> QString { enum { Size = sizeof(u"" "Rules")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Rules" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }())); | - | ||||||||||||||||||
214 | parser.setContent(stream); | - | ||||||||||||||||||
215 | erenvRules += parser.rules(); | - | ||||||||||||||||||
216 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||
217 | - | |||||||||||||||||||
218 | const QString configFileName = ([]() -> QString { enum { Size = sizeof(u"" "qtlogging.ini")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "qtlogging.ini" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 1081 times by 24 tests: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 1081 times by 24 tests: }());return qstring_literal_temp; Executed by:
| 1081 | ||||||||||||||||||
219 | - | |||||||||||||||||||
220 | - | |||||||||||||||||||
221 | - | |||||||||||||||||||
222 | const QString qtConfigPath | - | ||||||||||||||||||
223 | = QDir(QLibraryInfo::location(QLibraryInfo::DataPath)).absoluteFilePath(configFileName); | - | ||||||||||||||||||
224 | qrqtConfigRules = loadRulesFromFile(qtConfigPath); | - | ||||||||||||||||||
225 | - | |||||||||||||||||||
226 | - | |||||||||||||||||||
227 | - | |||||||||||||||||||
228 | const QString envPath = QStandardPaths::locate(QStandardPaths::GenericConfigLocation, | - | ||||||||||||||||||
229 | QString::fromLatin1("QtProject/") + configFileName); | - | ||||||||||||||||||
230 | if (!envPath.isEmpty()
| 1-1079 | ||||||||||||||||||
231 | crconfigRules executed 1 time by 1 test: = loadRulesFromFile(envPath);configRules = loadRulesFromFile(envPath); Executed by:
executed 1 time by 1 test: configRules = loadRulesFromFile(envPath); Executed by:
| 1 | ||||||||||||||||||
const QMutexLocker locker(®istryMutex); executed 1 time by 1 test: configRules = loadRulesFromFile(envPath); Executed by:
| ||||||||||||||||||||
envRules = std::move(er); executed 1 time by 1 test: configRules = loadRulesFromFile(envPath); Executed by:
| ||||||||||||||||||||
qtConfigRules = std::move(qr); executed 1 time by 1 test: configRules = loadRulesFromFile(envPath); Executed by:
| ||||||||||||||||||||
configRules = std::move(cr executed 1 time by 1 test: configRules = loadRulesFromFile(envPath); Executed by:
executed 1 time by 1 test: );configRules = loadRulesFromFile(envPath); Executed by:
executed 1 time by 1 test: configRules = loadRulesFromFile(envPath); Executed by:
| ||||||||||||||||||||
232 | - | |||||||||||||||||||
233 | if (!envRules.isEmpty()
| 0-1077 | ||||||||||||||||||
234 | QMutexLocker locker(®istryMutex); | - | ||||||||||||||||||
235 | updateRules(); | - | ||||||||||||||||||
236 | } executed 3 times by 1 test: end of block Executed by:
| 3 | ||||||||||||||||||
237 | } executed 1080 times by 24 tests: end of block Executed by:
| 1080 | ||||||||||||||||||
238 | - | |||||||||||||||||||
239 | - | |||||||||||||||||||
240 | - | |||||||||||||||||||
241 | - | |||||||||||||||||||
242 | - | |||||||||||||||||||
243 | - | |||||||||||||||||||
244 | - | |||||||||||||||||||
245 | void QLoggingRegistry::registerCategory(QLoggingCategory *cat, QtMsgType enableForLevel) | - | ||||||||||||||||||
246 | { | - | ||||||||||||||||||
247 | QMutexLocker locker(®istryMutex); | - | ||||||||||||||||||
248 | - | |||||||||||||||||||
249 | if (!categories.contains(cat)) { | - | ||||||||||||||||||
250 | categories.insert(cat, enableForLevel); | - | ||||||||||||||||||
251 | (*categoryFilter)(cat); | - | ||||||||||||||||||
252 | } | - | ||||||||||||||||||
253 | } | - | ||||||||||||||||||
254 | - | |||||||||||||||||||
255 | - | |||||||||||||||||||
256 | - | |||||||||||||||||||
257 | - | |||||||||||||||||||
258 | - | |||||||||||||||||||
259 | void QLoggingRegistry::unregisterCategory(QLoggingCategory *cat) | - | ||||||||||||||||||
260 | { | - | ||||||||||||||||||
261 | QMutexLocker locker(®istryMutex); | - | ||||||||||||||||||
262 | categories.remove(cat); | - | ||||||||||||||||||
263 | } | - | ||||||||||||||||||
264 | - | |||||||||||||||||||
265 | - | |||||||||||||||||||
266 | - | |||||||||||||||||||
267 | - | |||||||||||||||||||
268 | - | |||||||||||||||||||
269 | void QLoggingRegistry::setApiRules(const QString &content) | - | ||||||||||||||||||
270 | { | - | ||||||||||||||||||
271 | QLoggingSettingsParser parser; | - | ||||||||||||||||||
272 | parser.setSection(([]() -> QString { enum { Size = sizeof(u"" "Rules")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Rules" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }())); | - | ||||||||||||||||||
273 | parser.setContent(content); | - | ||||||||||||||||||
274 | - | |||||||||||||||||||
275 | QMutexLocker locker(®istryMutex); | - | ||||||||||||||||||
276 | - | |||||||||||||||||||
277 | if (qtLoggingDebug()
| 0-24019 | ||||||||||||||||||
278 | QMessageLogger(__FILE__, 351353, __FUNCTION__, "qt.core.logging").debug("Loading logging rules set by QLoggingCategory::setFilterRules ..."); never executed: QMessageLogger(__FILE__, 353, __FUNCTION__, "qt.core.logging").debug("Loading logging rules set by QLoggingCategory::setFilterRules ..."); | 0 | ||||||||||||||||||
const QMutexLocker locker(®istryMutex never executed: QMessageLogger(__FILE__, 353, __FUNCTION__, "qt.core.logging").debug("Loading logging rules set by QLoggingCategory::setFilterRules ..."); never executed: );QMessageLogger(__FILE__, 353, __FUNCTION__, "qt.core.logging").debug("Loading logging rules set by QLoggingCategory::setFilterRules ..."); never executed: QMessageLogger(__FILE__, 353, __FUNCTION__, "qt.core.logging").debug("Loading logging rules set by QLoggingCategory::setFilterRules ..."); | ||||||||||||||||||||
279 | - | |||||||||||||||||||
280 | apiRules = parser.rules(); | - | ||||||||||||||||||
281 | - | |||||||||||||||||||
282 | updateRules(); | - | ||||||||||||||||||
283 | } executed 24019 times by 2 tests: end of block Executed by:
| 24019 | ||||||||||||||||||
284 | - | |||||||||||||||||||
285 | - | |||||||||||||||||||
286 | - | |||||||||||||||||||
287 | - | |||||||||||||||||||
288 | - | |||||||||||||||||||
289 | - | |||||||||||||||||||
290 | - | |||||||||||||||||||
291 | void QLoggingRegistry::updateRules() | - | ||||||||||||||||||
292 | { | - | ||||||||||||||||||
293 | rules = qtConfigRules + configRules + apiRules + envRules; | - | ||||||||||||||||||
294 | - | |||||||||||||||||||
295 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(auto it = categories.keys())>::type> _container_((keyBegin(), end = categories.keys())); _container_.control && _container_.ikeyEnd(); it
| 24025-216136 | ||||||||||||||||||
296 | (* executed 216136 times by 2 tests: categoryFilter)(cat)(*it);(*categoryFilter)(*it); Executed by:
executed 216136 times by 2 tests: (*categoryFilter)(*it); Executed by:
| 216136 | ||||||||||||||||||
297 | } executed 24025 times by 2 tests: end of block Executed by:
| 24025 | ||||||||||||||||||
298 | - | |||||||||||||||||||
299 | - | |||||||||||||||||||
300 | - | |||||||||||||||||||
301 | - | |||||||||||||||||||
302 | - | |||||||||||||||||||
303 | QLoggingCategory::CategoryFilter | - | ||||||||||||||||||
304 | QLoggingRegistry::installFilter(QLoggingCategory::CategoryFilter filter) | - | ||||||||||||||||||
305 | { | - | ||||||||||||||||||
306 | QMutexLocker locker(®istryMutex); | - | ||||||||||||||||||
307 | - | |||||||||||||||||||
308 | if (filter == 0
| 3-4 | ||||||||||||||||||
309 | filter = defaultCategoryFilter; executed 3 times by 1 test: filter = defaultCategoryFilter; Executed by:
| 3 | ||||||||||||||||||
310 | - | |||||||||||||||||||
311 | QLoggingCategory::CategoryFilter old = categoryFilter; | - | ||||||||||||||||||
312 | categoryFilter = filter; | - | ||||||||||||||||||
313 | - | |||||||||||||||||||
314 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(auto it = categories.keys())>::type> _container_((keyBegin(), end = categories.keys())); _container_.control && _container_.ikeyEnd(); it
| 7-22 | ||||||||||||||||||
315 | (* executed 22 times by 1 test: categoryFilter)(cat)(*it);(*categoryFilter)(*it); Executed by:
executed 22 times by 1 test: (*categoryFilter)(*it); Executed by:
| 22 | ||||||||||||||||||
316 | - | |||||||||||||||||||
317 | return executed 7 times by 1 test: old;return old; Executed by:
executed 7 times by 1 test: return old; Executed by:
| 7 | ||||||||||||||||||
318 | } | - | ||||||||||||||||||
319 | - | |||||||||||||||||||
320 | QLoggingRegistry *QLoggingRegistry::instance() | - | ||||||||||||||||||
321 | { | - | ||||||||||||||||||
322 | return qtLoggingRegistry(); | - | ||||||||||||||||||
323 | } | - | ||||||||||||||||||
324 | - | |||||||||||||||||||
325 | - | |||||||||||||||||||
326 | - | |||||||||||||||||||
327 | - | |||||||||||||||||||
328 | - | |||||||||||||||||||
329 | void QLoggingRegistry::defaultCategoryFilter(QLoggingCategory *cat) | - | ||||||||||||||||||
330 | { | - | ||||||||||||||||||
331 | const QLoggingRegistry *reg = QLoggingRegistry::instance(); | - | ||||||||||||||||||
332 | ((!(reg->categories.contains(cat))) ? qt_assert("reg->categories.contains(cat)",__FILE__,409407) : qt_noop()); | - | ||||||||||||||||||
333 | QtMsgType enableForLevel = reg->categories.value(cat); | - | ||||||||||||||||||
334 | - | |||||||||||||||||||
335 | - | |||||||||||||||||||
336 | - | |||||||||||||||||||
337 | bool debug = (enableForLevel == QtDebugMsg); | - | ||||||||||||||||||
338 | bool info = debug
| 24020-169024 | ||||||||||||||||||
339 | bool warning = info
| 1-193044 | ||||||||||||||||||
340 | bool critical = warning
| 0-193045 | ||||||||||||||||||
341 | - | |||||||||||||||||||
342 | - | |||||||||||||||||||
343 | - | |||||||||||||||||||
344 | - | |||||||||||||||||||
345 | if (const
| 0-217065 | ||||||||||||||||||
346 | - | |||||||||||||||||||
347 | if (strcmp(categoryName, "qt") == 0
| 0-217065 | ||||||||||||||||||
348 | debug = false; executed 379 times by 137 tests: debug = false; Executed by:
| 379 | ||||||||||||||||||
349 | } executed 217065 times by 243 tests: end of block Executed by:
| 217065 | ||||||||||||||||||
350 | - | |||||||||||||||||||
351 | QString categoryName = QLatin1String(cat->categoryName()); | - | ||||||||||||||||||
352 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(reg->rules)>::type> _container_((reg->rules)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1)for (const QLoggingRule &item = *_container_.i; _container_.control; _container_.control = 0: reg->rules) { | - | ||||||||||||||||||
353 | int filterpass = item.pass(categoryName, QtDebugMsg); | - | ||||||||||||||||||
354 | if (filterpass != 0
| 72079-144381 | ||||||||||||||||||
355 | debug = (filterpass > 0); executed 72079 times by 2 tests: debug = (filterpass > 0); Executed by:
| 72079 | ||||||||||||||||||
356 | filterpass = item.pass(categoryName, QtInfoMsg); | - | ||||||||||||||||||
357 | if (filterpass != 0
| 72067-144393 | ||||||||||||||||||
358 | info = (filterpass > 0); executed 72067 times by 2 tests: info = (filterpass > 0); Executed by:
| 72067 | ||||||||||||||||||
359 | filterpass = item.pass(categoryName, QtWarningMsg); | - | ||||||||||||||||||
360 | if (filterpass != 0
| 72067-144393 | ||||||||||||||||||
361 | warning = (filterpass > 0); executed 72067 times by 2 tests: warning = (filterpass > 0); Executed by:
| 72067 | ||||||||||||||||||
362 | filterpass = item.pass(categoryName, QtCriticalMsg); | - | ||||||||||||||||||
363 | if (filterpass != 0
| 72066-144394 | ||||||||||||||||||
364 | critical = (filterpass > 0); executed 72066 times by 2 tests: critical = (filterpass > 0); Executed by:
| 72066 | ||||||||||||||||||
365 | } executed 216460 times by 2 tests: end of block Executed by:
| 216460 | ||||||||||||||||||
366 | - | |||||||||||||||||||
367 | cat->setEnabled(QtDebugMsg, debug); | - | ||||||||||||||||||
368 | cat->setEnabled(QtInfoMsg, info); | - | ||||||||||||||||||
369 | cat->setEnabled(QtWarningMsg, warning); | - | ||||||||||||||||||
370 | cat->setEnabled(QtCriticalMsg, critical); | - | ||||||||||||||||||
371 | } executed 217065 times by 243 tests: end of block Executed by:
| 217065 | ||||||||||||||||||
372 | - | |||||||||||||||||||
373 | - | |||||||||||||||||||
374 | - | |||||||||||||||||||
Switch to Source code | Preprocessed file |