qloggingregistry.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/corelib/io/qloggingregistry.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2015 The Qt Company Ltd.-
4** Contact: http://www.qt.io/licensing/-
5**-
6** This file is part of the QtCore module of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL21$-
9** Commercial License Usage-
10** Licensees holding valid commercial Qt licenses may use this file in-
11** accordance with the commercial license agreement provided with the-
12** Software or, alternatively, in accordance with the terms contained in-
13** a written agreement between you and The Qt Company. For licensing terms-
14** and conditions see http://www.qt.io/terms-conditions. For further-
15** information use the contact form at http://www.qt.io/contact-us.-
16**-
17** GNU Lesser General Public License Usage-
18** Alternatively, this file may be used under the terms of the GNU Lesser-
19** General Public License version 2.1 or version 3 as published by the Free-
20** Software Foundation and appearing in the file LICENSE.LGPLv21 and-
21** LICENSE.LGPLv3 included in the packaging of this file. Please review the-
22** following information to ensure the GNU Lesser General Public License-
23** requirements will be met: https://www.gnu.org/licenses/lgpl.html and-
24** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.-
25**-
26** As a special exception, The Qt Company gives you certain additional-
27** rights. These rights are described in The Qt Company LGPL Exception-
28** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.-
29**-
30** $QT_END_LICENSE$-
31**-
32****************************************************************************/-
33-
34#include "qloggingregistry_p.h"-
35-
36#include <QtCore/qfile.h>-
37#include <QtCore/qlibraryinfo.h>-
38#include <QtCore/qstandardpaths.h>-
39#include <QtCore/qtextstream.h>-
40#include <QtCore/qdir.h>-
41-
42// We can't use the default macros because this would lead to recursion.-
43// Instead let's define our own one that unconditionally logs...-
44#define debugMsg QMessageLogger(__FILE__, __LINE__, __FUNCTION__, "qt.core.logging").debug-
45#define warnMsg QMessageLogger(__FILE__, __LINE__, __FUNCTION__, "qt.core.logging").warning-
46-
47-
48QT_BEGIN_NAMESPACE-
49-
50Q_GLOBAL_STATIC(QLoggingRegistry, qtLoggingRegistry)
executed 992 times by 430 tests: end of block
Executed by:
  • tst_compiler - unknown status
  • tst_gestures - unknown status
  • tst_lancelot - unknown status
  • tst_languagechange - unknown status
  • tst_largefile - unknown status
  • tst_modeltest - unknown status
  • tst_networkselftest - unknown status
  • tst_platformsocketengine - unknown status
  • tst_q_func_info - unknown status
  • tst_qabstractanimation - unknown status
  • tst_qabstractbutton - unknown status
  • tst_qabstractitemmodel - unknown status
  • tst_qabstractitemview - unknown status
  • tst_qabstractnetworkcache - unknown status
  • tst_qabstractprintdialog - unknown status
  • tst_qabstractproxymodel - unknown status
  • tst_qabstractscrollarea - unknown status
  • tst_qabstractslider - unknown status
  • tst_qabstractsocket - unknown status
  • tst_qabstractspinbox - unknown status
  • tst_qabstracttextdocumentlayout - unknown status
  • tst_qaccessibility - unknown status
  • tst_qaction - unknown status
  • tst_qactiongroup - unknown status
  • tst_qanimationgroup - unknown status
  • ...
executed 992 times by 430 tests: guard.store(QtGlobalStatic::Destroyed);
Executed by:
  • tst_compiler - unknown status
  • tst_gestures - unknown status
  • tst_lancelot - unknown status
  • tst_languagechange - unknown status
  • tst_largefile - unknown status
  • tst_modeltest - unknown status
  • tst_networkselftest - unknown status
  • tst_platformsocketengine - unknown status
  • tst_q_func_info - unknown status
  • tst_qabstractanimation - unknown status
  • tst_qabstractbutton - unknown status
  • tst_qabstractitemmodel - unknown status
  • tst_qabstractitemview - unknown status
  • tst_qabstractnetworkcache - unknown status
  • tst_qabstractprintdialog - unknown status
  • tst_qabstractproxymodel - unknown status
  • tst_qabstractscrollarea - unknown status
  • tst_qabstractslider - unknown status
  • tst_qabstractsocket - unknown status
  • tst_qabstractspinbox - unknown status
  • tst_qabstracttextdocumentlayout - unknown status
  • tst_qaccessibility - unknown status
  • tst_qaction - unknown status
  • tst_qactiongroup - unknown status
  • tst_qanimationgroup - unknown status
  • ...
executed 244159 times by 547 tests: return &holder.value;
Executed by:
  • tst_Compiler
  • tst_Gestures
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QArrayData
  • tst_QArrayData_StrictIterators
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QBrush
  • tst_QBuffer
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • ...
guard.load() =...c::InitializedDescription
TRUEevaluated 992 times by 430 tests
Evaluated by:
  • tst_compiler - unknown status
  • tst_gestures - unknown status
  • tst_lancelot - unknown status
  • tst_languagechange - unknown status
  • tst_largefile - unknown status
  • tst_modeltest - unknown status
  • tst_networkselftest - unknown status
  • tst_platformsocketengine - unknown status
  • tst_q_func_info - unknown status
  • tst_qabstractanimation - unknown status
  • tst_qabstractbutton - unknown status
  • tst_qabstractitemmodel - unknown status
  • tst_qabstractitemview - unknown status
  • tst_qabstractnetworkcache - unknown status
  • tst_qabstractprintdialog - unknown status
  • tst_qabstractproxymodel - unknown status
  • tst_qabstractscrollarea - unknown status
  • tst_qabstractslider - unknown status
  • tst_qabstractsocket - unknown status
  • tst_qabstractspinbox - unknown status
  • tst_qabstracttextdocumentlayout - unknown status
  • tst_qaccessibility - unknown status
  • tst_qaction - unknown status
  • tst_qactiongroup - unknown status
  • tst_qanimationgroup - unknown status
  • ...
FALSEnever evaluated
0-244159
51-
52/*!-
53 \internal-
54 Constructs a logging rule with default values.-
55*/-
56QLoggingRule::QLoggingRule() :-
57 enabled(false)-
58{-
59}
never executed: end of block
0
60-
61/*!-
62 \internal-
63 Constructs a logging rule.-
64*/-
65QLoggingRule::QLoggingRule(const QStringRef &pattern, bool enabled) :-
66 messageType(-1),-
67 enabled(enabled)-
68{-
69 parse(pattern);-
70}
executed 24116 times by 2 tests: end of block
Executed by:
  • tst_QLogging
  • tst_QLoggingRegistry
24116
71-
72/*!-
73 \internal-
74 Return value 1 means filter passed, 0 means filter doesn't influence this-
75 category, -1 means category doesn't pass this filter.-
76 */-
77int QLoggingRule::pass(const QString &cat, QtMsgType msgType) const-
78{-
79 // check message type-
80 if (messageType > -1 && messageType != msgType)
messageType > -1Description
TRUEevaluated 516 times by 2 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
FALSEevaluated 865359 times by 2 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
messageType != msgTypeDescription
TRUEevaluated 384 times by 2 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
FALSEevaluated 132 times by 2 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
132-865359
81 return 0;
executed 384 times by 2 tests: return 0;
Executed by:
  • tst_QLogging
  • tst_QLoggingRegistry
384
82-
83 if (flags == FullText) {
flags == FullTextDescription
TRUEevaluated 1050 times by 2 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
FALSEevaluated 864441 times by 2 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
1050-864441
84 // full match-
85 if (category == cat)
category == catDescription
TRUEevaluated 127 times by 2 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
FALSEevaluated 923 times by 2 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
127-923
86 return (enabled ? 1 : -1);
executed 127 times by 2 tests: return (enabled ? 1 : -1);
Executed by:
  • tst_QLogging
  • tst_QLoggingRegistry
enabledDescription
TRUEevaluated 44 times by 2 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
FALSEevaluated 83 times by 1 test
Evaluated by:
  • tst_QLogging
44-127
87 else-
88 return 0;
executed 923 times by 2 tests: return 0;
Executed by:
  • tst_QLogging
  • tst_QLoggingRegistry
923
89 }-
90-
91 const int idx = cat.indexOf(category);-
92 if (idx >= 0) {
idx >= 0Description
TRUEevaluated 288174 times by 2 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
FALSEevaluated 576267 times by 2 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
288174-576267
93 if (flags == MidFilter) {
flags == MidFilterDescription
TRUEevaluated 75 times by 2 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
FALSEevaluated 288099 times by 2 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
75-288099
94 // matches somewhere-
95 if (idx >= 0)
idx >= 0Description
TRUEevaluated 75 times by 2 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
FALSEnever evaluated
0-75
96 return (enabled ? 1 : -1);
executed 75 times by 2 tests: return (enabled ? 1 : -1);
Executed by:
  • tst_QLogging
  • tst_QLoggingRegistry
enabledDescription
TRUEevaluated 27 times by 2 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
FALSEevaluated 48 times by 1 test
Evaluated by:
  • tst_QLogging
27-75
97 } else if (flags == LeftFilter) {
never executed: end of block
flags == LeftFilterDescription
TRUEevaluated 288081 times by 2 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
FALSEevaluated 18 times by 2 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
0-288081
98 // matches left-
99 if (idx == 0)
idx == 0Description
TRUEevaluated 288081 times by 2 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
FALSEnever evaluated
0-288081
100 return (enabled ? 1 : -1);
executed 288081 times by 2 tests: return (enabled ? 1 : -1);
Executed by:
  • tst_QLogging
  • tst_QLoggingRegistry
enabledDescription
TRUEevaluated 144041 times by 2 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
FALSEevaluated 144040 times by 2 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
144040-288081
101 } else if (flags == RightFilter) {
never executed: end of block
flags == RightFilterDescription
TRUEevaluated 18 times by 2 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
FALSEnever evaluated
0-18
102 // matches right-
103 if (idx == (cat.count() - category.count()))
idx == (cat.co...egory.count())Description
TRUEevaluated 16 times by 2 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QLoggingRegistry
2-16
104 return (enabled ? 1 : -1);
executed 16 times by 2 tests: return (enabled ? 1 : -1);
Executed by:
  • tst_QLogging
  • tst_QLoggingRegistry
enabledDescription
TRUEevaluated 7 times by 2 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
FALSEevaluated 9 times by 1 test
Evaluated by:
  • tst_QLogging
7-16
105 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_QLoggingRegistry
2
106 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_QLoggingRegistry
2
107 return 0;
executed 576269 times by 2 tests: return 0;
Executed by:
  • tst_QLogging
  • tst_QLoggingRegistry
576269
108}-
109-
110/*!-
111 \internal-
112 Parses \a pattern.-
113 Allowed is f.ex.:-
114 qt.core.io.debug FullText, QtDebugMsg-
115 qt.core.* LeftFilter, all types-
116 *.io.warning RightFilter, QtWarningMsg-
117 *.core.* MidFilter-
118 */-
119void QLoggingRule::parse(const QStringRef &pattern)-
120{-
121 QStringRef p;-
122-
123 // strip trailing ".messagetype"-
124 if (pattern.endsWith(QLatin1String(".debug"))) {
pattern.endsWi...ing(".debug"))Description
TRUEevaluated 14 times by 2 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
FALSEevaluated 24102 times by 2 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
14-24102
125 p = QStringRef(pattern.string(), pattern.position(),-
126 pattern.length() - 6); // strlen(".debug")-
127 messageType = QtDebugMsg;-
128 } else if (pattern.endsWith(QLatin1String(".info"))) {
executed 14 times by 2 tests: end of block
Executed by:
  • tst_QLogging
  • tst_QLoggingRegistry
pattern.endsWi...ring(".info"))Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QLogging
FALSEevaluated 24098 times by 2 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
4-24098
129 p = QStringRef(pattern.string(), pattern.position(),-
130 pattern.length() - 5); // strlen(".info")-
131 messageType = QtInfoMsg;-
132 } else if (pattern.endsWith(QLatin1String(".warning"))) {
executed 4 times by 1 test: end of block
Executed by:
  • tst_QLogging
pattern.endsWi...g(".warning"))Description
TRUEevaluated 9 times by 2 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
FALSEevaluated 24089 times by 2 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
4-24089
133 p = QStringRef(pattern.string(), pattern.position(),-
134 pattern.length() - 8); // strlen(".warning")-
135 messageType = QtWarningMsg;-
136 } else if (pattern.endsWith(QLatin1String(".critical"))) {
executed 9 times by 2 tests: end of block
Executed by:
  • tst_QLogging
  • tst_QLoggingRegistry
pattern.endsWi...(".critical"))Description
TRUEevaluated 4 times by 2 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
FALSEevaluated 24085 times by 2 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
4-24085
137 p = QStringRef(pattern.string(), pattern.position(),-
138 pattern.length() - 9); // strlen(".critical")-
139 messageType = QtCriticalMsg;-
140 } else {
executed 4 times by 2 tests: end of block
Executed by:
  • tst_QLogging
  • tst_QLoggingRegistry
4
141 p = pattern;-
142 }
executed 24085 times by 2 tests: end of block
Executed by:
  • tst_QLogging
  • tst_QLoggingRegistry
24085
143-
144 if (!p.contains(QLatin1Char('*'))) {
!p.contains(QLatin1Char('*'))Description
TRUEevaluated 63 times by 2 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
FALSEevaluated 24053 times by 2 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
63-24053
145 flags = FullText;-
146 } else {
executed 63 times by 2 tests: end of block
Executed by:
  • tst_QLogging
  • tst_QLoggingRegistry
63
147 if (p.endsWith(QLatin1Char('*'))) {
p.endsWith(QLatin1Char('*'))Description
TRUEevaluated 24040 times by 2 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
FALSEevaluated 13 times by 2 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
13-24040
148 flags |= LeftFilter;-
149 p = QStringRef(p.string(), p.position(), p.length() - 1);-
150 }
executed 24040 times by 2 tests: end of block
Executed by:
  • tst_QLogging
  • tst_QLoggingRegistry
24040
151 if (p.startsWith(QLatin1Char('*'))) {
p.startsWith(QLatin1Char('*'))Description
TRUEevaluated 25 times by 2 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
FALSEevaluated 24028 times by 2 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
25-24028
152 flags |= RightFilter;-
153 p = QStringRef(p.string(), p.position() + 1, p.length() - 1);-
154 }
executed 25 times by 2 tests: end of block
Executed by:
  • tst_QLogging
  • tst_QLoggingRegistry
25
155 if (p.contains(QLatin1Char('*'))) // '*' only supported at start/end
p.contains(QLatin1Char('*'))Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QLoggingRegistry
FALSEevaluated 24050 times by 2 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
3-24050
156 flags = 0;
executed 3 times by 1 test: flags = 0;
Executed by:
  • tst_QLoggingRegistry
3
157 }
executed 24053 times by 2 tests: end of block
Executed by:
  • tst_QLogging
  • tst_QLoggingRegistry
24053
158-
159 category = p.toString();-
160}
executed 24116 times by 2 tests: end of block
Executed by:
  • tst_QLogging
  • tst_QLoggingRegistry
24116
161-
162/*!-
163 \class QLoggingSettingsParser-
164 \since 5.3-
165 \internal-
166-
167 Parses a .ini file with the following format:-
168-
169 [rules]-
170 rule1=[true|false]-
171 rule2=[true|false]-
172 ...-
173-
174 [rules] is the default section, and therefore optional.-
175*/-
176-
177/*!-
178 \internal-
179 Parses configuration from \a content.-
180*/-
181void QLoggingSettingsParser::setContent(const QString &content)-
182{-
183 QString content_ = content;-
184 QTextStream stream(&content_, QIODevice::ReadOnly);-
185 setContent(stream);-
186}
executed 24025 times by 2 tests: end of block
Executed by:
  • tst_QLogging
  • tst_QLoggingRegistry
24025
187-
188/*!-
189 \internal-
190 Parses configuration from \a stream.-
191*/-
192void QLoggingSettingsParser::setContent(QTextStream &stream)-
193{-
194 _rules.clear();-
195 while (!stream.atEnd()) {
!stream.atEnd()Description
TRUEevaluated 24089 times by 2 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
FALSEevaluated 24031 times by 2 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
24031-24089
196 QString line = stream.readLine();-
197-
198 // Remove all whitespace from line-
199 line = line.simplified();-
200 line.remove(QLatin1Char(' '));-
201-
202 // comment-
203 if (line.startsWith(QLatin1Char(';')))
line.startsWit...tin1Char(';'))Description
TRUEnever evaluated
FALSEevaluated 24089 times by 2 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
0-24089
204 continue;
never executed: continue;
0
205-
206 if (line.startsWith(QLatin1Char('[')) && line.endsWith(QLatin1Char(']'))) {
line.startsWit...tin1Char('['))Description
TRUEevaluated 9 times by 1 test
Evaluated by:
  • tst_QLoggingRegistry
FALSEevaluated 24080 times by 2 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
line.endsWith(...tin1Char(']'))Description
TRUEevaluated 9 times by 1 test
Evaluated by:
  • tst_QLoggingRegistry
FALSEnever evaluated
0-24080
207 // new section-
208 _section = line.mid(1, line.size() - 2);-
209 continue;
executed 9 times by 1 test: continue;
Executed by:
  • tst_QLoggingRegistry
9
210 }-
211-
212 if (_section.toLower() == QLatin1String("rules")) {
_section.toLow...tring("rules")Description
TRUEevaluated 24079 times by 2 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QLoggingRegistry
1-24079
213 int equalPos = line.indexOf(QLatin1Char('='));-
214 if (equalPos != -1) {
equalPos != -1Description
TRUEevaluated 24079 times by 2 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
FALSEnever evaluated
0-24079
215 if (line.lastIndexOf(QLatin1Char('=')) == equalPos) {
line.lastIndex...)) == equalPosDescription
TRUEevaluated 24079 times by 2 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
FALSEnever evaluated
0-24079
216 const QStringRef pattern = line.leftRef(equalPos);-
217 const QStringRef valueStr = line.midRef(equalPos + 1);-
218 int value = -1;-
219 if (valueStr == QLatin1String("true"))
valueStr == QL...String("true")Description
TRUEevaluated 12029 times by 2 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
FALSEevaluated 12050 times by 2 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
12029-12050
220 value = 1;
executed 12029 times by 2 tests: value = 1;
Executed by:
  • tst_QLogging
  • tst_QLoggingRegistry
12029
221 else if (valueStr == QLatin1String("false"))
valueStr == QL...tring("false")Description
TRUEevaluated 12041 times by 2 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
FALSEevaluated 9 times by 2 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
9-12041
222 value = 0;
executed 12041 times by 2 tests: value = 0;
Executed by:
  • tst_QLogging
  • tst_QLoggingRegistry
12041
223 QLoggingRule rule(pattern, (value == 1));-
224 if (rule.flags != 0 && (value != -1))
rule.flags != 0Description
TRUEevaluated 24078 times by 2 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QLoggingRegistry
(value != -1)Description
TRUEevaluated 24069 times by 2 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
FALSEevaluated 9 times by 2 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
1-24078
225 _rules.append(rule);
executed 24069 times by 2 tests: _rules.append(rule);
Executed by:
  • tst_QLogging
  • tst_QLoggingRegistry
24069
226 else-
227 warnMsg("Ignoring malformed logging rule: '%s'", line.toUtf8().constData());
executed 10 times by 2 tests: QMessageLogger(__FILE__, 227, __FUNCTION__, "qt.core.logging").warning("Ignoring malformed logging rule: '%s'", line.toUtf8().constData());
Executed by:
  • tst_QLogging
  • tst_QLoggingRegistry
10
228 } else {-
229 warnMsg("Ignoring malformed logging rule: '%s'", line.toUtf8().constData());-
230 }
never executed: end of block
0
231 }-
232 }
executed 24079 times by 2 tests: end of block
Executed by:
  • tst_QLogging
  • tst_QLoggingRegistry
24079
233 }
executed 24080 times by 2 tests: end of block
Executed by:
  • tst_QLogging
  • tst_QLoggingRegistry
24080
234}
executed 24031 times by 2 tests: end of block
Executed by:
  • tst_QLogging
  • tst_QLoggingRegistry
24031
235-
236/*!-
237 \internal-
238 QLoggingRegistry constructor-
239 */-
240QLoggingRegistry::QLoggingRegistry()-
241 : categoryFilter(defaultCategoryFilter)-
242{-
243}
executed 672 times by 33 tests: end of block
Executed by:
  • tst_LargeFile
  • tst_QApplication
  • tst_QArrayData
  • tst_QArrayData_StrictIterators
  • tst_QCommandLineParser
  • tst_QCoreApplication
  • tst_QDBusConnectionNoBus
  • tst_QDBusConnectionNoLibDBus1
  • tst_QDBusConnection_Delayed
  • tst_QDate
  • tst_QDateTime
  • tst_QDnsLookup_Appless
  • tst_QGlobal
  • tst_QGuiApplication
  • tst_QLoggingRegistry
  • tst_QNetworkConfigurationManager
  • tst_QPainterPath
  • tst_QRegularExpression_AlwaysOptimize
  • tst_QRegularExpression_DefaultOptimize
  • tst_QRegularExpression_ForceOptimize
  • tst_QSql
  • tst_QString
  • tst_qapplication - unknown status
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusabstractinterface - unknown status
  • ...
672
244-
245static bool qtLoggingDebug()-
246{-
247 static const bool debugEnv = qEnvironmentVariableIsSet("QT_LOGGING_DEBUG");-
248 return debugEnv;
executed 24023 times by 2 tests: return debugEnv;
Executed by:
  • tst_QLogging
  • tst_QLoggingRegistry
24023
249}-
250-
251static QVector<QLoggingRule> loadRulesFromFile(const QString &filePath)-
252{-
253 QFile file(filePath);-
254 if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
file.open(QIOD...ODevice::Text)Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QLoggingRegistry
FALSEevaluated 870 times by 23 tests
Evaluated by:
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QCoreApplication
  • tst_QDBusConnectionNoBus
  • tst_QDBusConnectionNoLibDBus1
  • tst_QDBusConnection_Delayed
  • tst_QDnsLookup_Appless
  • tst_QGlobal
  • tst_QGuiApplication
  • tst_QLoggingRegistry
  • tst_QNetworkConfigurationManager
  • tst_QSql
  • tst_qapplication - unknown status
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusinterface - unknown status
  • tst_qdbusmarshall - unknown status
  • tst_qlogging - unknown status
  • tst_qobject - unknown status
  • tst_qprocess - unknown status
  • tst_qsharedmemory - unknown status
  • tst_qsystemsemaphore - unknown status
  • tst_selftests - unknown status
4-870
255 if (qtLoggingDebug())
qtLoggingDebug()Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QLoggingRegistry
0-4
256 debugMsg("Loading \"%s\" ...",
never executed: QMessageLogger(__FILE__, 256, __FUNCTION__, "qt.core.logging").debug("Loading \"%s\" ...", QDir::toNativeSeparators(file.fileName()).toUtf8().constData());
0
257 QDir::toNativeSeparators(file.fileName()).toUtf8().constData());
never executed: QMessageLogger(__FILE__, 256, __FUNCTION__, "qt.core.logging").debug("Loading \"%s\" ...", QDir::toNativeSeparators(file.fileName()).toUtf8().constData());
0
258 QTextStream stream(&file);-
259 QLoggingSettingsParser parser;-
260 parser.setContent(stream);-
261 return parser.rules();
executed 4 times by 1 test: return parser.rules();
Executed by:
  • tst_QLoggingRegistry
4
262 }-
263 return QVector<QLoggingRule>();
executed 870 times by 23 tests: return QVector<QLoggingRule>();
Executed by:
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QCoreApplication
  • tst_QDBusConnectionNoBus
  • tst_QDBusConnectionNoLibDBus1
  • tst_QDBusConnection_Delayed
  • tst_QDnsLookup_Appless
  • tst_QGlobal
  • tst_QGuiApplication
  • tst_QLoggingRegistry
  • tst_QNetworkConfigurationManager
  • tst_QSql
  • tst_qapplication - unknown status
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusinterface - unknown status
  • tst_qdbusmarshall - unknown status
  • tst_qlogging - unknown status
  • tst_qobject - unknown status
  • tst_qprocess - unknown status
  • tst_qsharedmemory - unknown status
  • tst_qsystemsemaphore - unknown status
  • tst_selftests - unknown status
870
264}-
265-
266/*!-
267 \internal-
268 Initializes the rules database by loading-
269 $QT_LOGGING_CONF, $QT_LOGGING_RULES, and .config/QtProject/qtlogging.ini.-
270 */-
271void QLoggingRegistry::init()-
272{-
273 QVector<QLoggingRule> er, qr, cr;-
274 // get rules from environment-
275 const QByteArray rulesFilePath = qgetenv("QT_LOGGING_CONF");-
276 if (!rulesFilePath.isEmpty())
!rulesFilePath.isEmpty()Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QLoggingRegistry
FALSEevaluated 868 times by 22 tests
Evaluated by:
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QCoreApplication
  • tst_QDBusConnectionNoBus
  • tst_QDBusConnectionNoLibDBus1
  • tst_QDBusConnection_Delayed
  • tst_QDnsLookup_Appless
  • tst_QGlobal
  • tst_QGuiApplication
  • tst_QNetworkConfigurationManager
  • tst_QSql
  • tst_qapplication - unknown status
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusinterface - unknown status
  • tst_qdbusmarshall - unknown status
  • tst_qlogging - unknown status
  • tst_qobject - unknown status
  • tst_qprocess - unknown status
  • tst_qsharedmemory - unknown status
  • tst_qsystemsemaphore - unknown status
  • tst_selftests - unknown status
3-868
277 er = loadRulesFromFile(QFile::decodeName(rulesFilePath));
executed 3 times by 1 test: er = loadRulesFromFile(QFile::decodeName(rulesFilePath));
Executed by:
  • tst_QLoggingRegistry
3
278-
279 const QByteArray rulesSrc = qgetenv("QT_LOGGING_RULES").replace(';', '\n');-
280 if (!rulesSrc.isEmpty()) {
!rulesSrc.isEmpty()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QLoggingRegistry
FALSEevaluated 869 times by 23 tests
Evaluated by:
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QCoreApplication
  • tst_QDBusConnectionNoBus
  • tst_QDBusConnectionNoLibDBus1
  • tst_QDBusConnection_Delayed
  • tst_QDnsLookup_Appless
  • tst_QGlobal
  • tst_QGuiApplication
  • tst_QLoggingRegistry
  • tst_QNetworkConfigurationManager
  • tst_QSql
  • tst_qapplication - unknown status
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusinterface - unknown status
  • tst_qdbusmarshall - unknown status
  • tst_qlogging - unknown status
  • tst_qobject - unknown status
  • tst_qprocess - unknown status
  • tst_qsharedmemory - unknown status
  • tst_qsystemsemaphore - unknown status
  • tst_selftests - unknown status
2-869
281 QTextStream stream(rulesSrc);-
282 QLoggingSettingsParser parser;-
283 parser.setSection(QStringLiteral("Rules"));
executed 2 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_QLoggingRegistry
2
284 parser.setContent(stream);-
285 er += parser.rules();-
286 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_QLoggingRegistry
2
287-
288 const QString configFileName = QStringLiteral("qtlogging.ini");
executed 871 times by 23 tests: return qstring_literal_temp;
Executed by:
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QCoreApplication
  • tst_QDBusConnectionNoBus
  • tst_QDBusConnectionNoLibDBus1
  • tst_QDBusConnection_Delayed
  • tst_QDnsLookup_Appless
  • tst_QGlobal
  • tst_QGuiApplication
  • tst_QLoggingRegistry
  • tst_QNetworkConfigurationManager
  • tst_QSql
  • tst_qapplication - unknown status
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusinterface - unknown status
  • tst_qdbusmarshall - unknown status
  • tst_qlogging - unknown status
  • tst_qobject - unknown status
  • tst_qprocess - unknown status
  • tst_qsharedmemory - unknown status
  • tst_qsystemsemaphore - unknown status
  • tst_selftests - unknown status
871
289-
290#if !defined(QT_BOOTSTRAPPED)-
291 // get rules from Qt data configuration path-
292 const QString qtConfigPath-
293 = QDir(QLibraryInfo::location(QLibraryInfo::DataPath)).absoluteFilePath(configFileName);-
294 qr = loadRulesFromFile(qtConfigPath);-
295#endif-
296-
297 // get rules from user's/system configuration-
298 const QString envPath = QStandardPaths::locate(QStandardPaths::GenericConfigLocation,-
299 QString::fromLatin1("QtProject/") + configFileName);-
300 if (!envPath.isEmpty())
!envPath.isEmpty()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QLoggingRegistry
FALSEevaluated 869 times by 23 tests
Evaluated by:
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QCoreApplication
  • tst_QDBusConnectionNoBus
  • tst_QDBusConnectionNoLibDBus1
  • tst_QDBusConnection_Delayed
  • tst_QDnsLookup_Appless
  • tst_QGlobal
  • tst_QGuiApplication
  • tst_QLoggingRegistry
  • tst_QNetworkConfigurationManager
  • tst_QSql
  • tst_qapplication - unknown status
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusinterface - unknown status
  • tst_qdbusmarshall - unknown status
  • tst_qlogging - unknown status
  • tst_qobject - unknown status
  • tst_qprocess - unknown status
  • tst_qsharedmemory - unknown status
  • tst_qsystemsemaphore - unknown status
  • tst_selftests - unknown status
1-869
301 cr = loadRulesFromFile(envPath);
executed 1 time by 1 test: cr = loadRulesFromFile(envPath);
Executed by:
  • tst_QLoggingRegistry
1
302-
303 const QMutexLocker locker(&registryMutex);-
304-
305 envRules = qMove(er);-
306 qtConfigRules = qMove(qr);-
307 configRules = qMove(cr);-
308-
309 if (!envRules.isEmpty() || !qtConfigRules.isEmpty() || !configRules.isEmpty()) {
!envRules.isEmpty()Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QLoggingRegistry
FALSEevaluated 867 times by 22 tests
Evaluated by:
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QCoreApplication
  • tst_QDBusConnectionNoBus
  • tst_QDBusConnectionNoLibDBus1
  • tst_QDBusConnection_Delayed
  • tst_QDnsLookup_Appless
  • tst_QGlobal
  • tst_QGuiApplication
  • tst_QNetworkConfigurationManager
  • tst_QSql
  • tst_qapplication - unknown status
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusinterface - unknown status
  • tst_qdbusmarshall - unknown status
  • tst_qlogging - unknown status
  • tst_qobject - unknown status
  • tst_qprocess - unknown status
  • tst_qsharedmemory - unknown status
  • tst_qsystemsemaphore - unknown status
  • tst_selftests - unknown status
!qtConfigRules.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 867 times by 22 tests
Evaluated by:
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QCoreApplication
  • tst_QDBusConnectionNoBus
  • tst_QDBusConnectionNoLibDBus1
  • tst_QDBusConnection_Delayed
  • tst_QDnsLookup_Appless
  • tst_QGlobal
  • tst_QGuiApplication
  • tst_QNetworkConfigurationManager
  • tst_QSql
  • tst_qapplication - unknown status
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusinterface - unknown status
  • tst_qdbusmarshall - unknown status
  • tst_qlogging - unknown status
  • tst_qobject - unknown status
  • tst_qprocess - unknown status
  • tst_qsharedmemory - unknown status
  • tst_qsystemsemaphore - unknown status
  • tst_selftests - unknown status
!configRules.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 867 times by 22 tests
Evaluated by:
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QCoreApplication
  • tst_QDBusConnectionNoBus
  • tst_QDBusConnectionNoLibDBus1
  • tst_QDBusConnection_Delayed
  • tst_QDnsLookup_Appless
  • tst_QGlobal
  • tst_QGuiApplication
  • tst_QNetworkConfigurationManager
  • tst_QSql
  • tst_qapplication - unknown status
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusinterface - unknown status
  • tst_qdbusmarshall - unknown status
  • tst_qlogging - unknown status
  • tst_qobject - unknown status
  • tst_qprocess - unknown status
  • tst_qsharedmemory - unknown status
  • tst_qsystemsemaphore - unknown status
  • tst_selftests - unknown status
0-867
310 updateRules();-
311 }
executed 3 times by 1 test: end of block
Executed by:
  • tst_QLoggingRegistry
3
312}
executed 870 times by 23 tests: end of block
Executed by:
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QCoreApplication
  • tst_QDBusConnectionNoBus
  • tst_QDBusConnectionNoLibDBus1
  • tst_QDBusConnection_Delayed
  • tst_QDnsLookup_Appless
  • tst_QGlobal
  • tst_QGuiApplication
  • tst_QLoggingRegistry
  • tst_QNetworkConfigurationManager
  • tst_QSql
  • tst_qapplication - unknown status
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusinterface - unknown status
  • tst_qdbusmarshall - unknown status
  • tst_qlogging - unknown status
  • tst_qobject - unknown status
  • tst_qprocess - unknown status
  • tst_qsharedmemory - unknown status
  • tst_qsystemsemaphore - unknown status
  • tst_selftests - unknown status
870
313-
314/*!-
315 \internal-
316 Registers a category object.-
317-
318 This method might be called concurrently for the same category object.-
319*/-
320void QLoggingRegistry::registerCategory(QLoggingCategory *cat, QtMsgType enableForLevel)-
321{-
322 QMutexLocker locker(&registryMutex);-
323-
324 if (!categories.contains(cat)) {
!categories.contains(cat)Description
TRUEevaluated 846 times by 243 tests
Evaluated by:
  • tst_Compiler
  • tst_Gestures
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QArrayData
  • tst_QArrayData_StrictIterators
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QBrush
  • tst_QBuffer
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • ...
FALSEnever evaluated
0-846
325 categories.insert(cat, enableForLevel);-
326 (*categoryFilter)(cat);-
327 }
executed 846 times by 243 tests: end of block
Executed by:
  • tst_Compiler
  • tst_Gestures
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QArrayData
  • tst_QArrayData_StrictIterators
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QBrush
  • tst_QBuffer
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • ...
846
328}
executed 846 times by 243 tests: end of block
Executed by:
  • tst_Compiler
  • tst_Gestures
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QArrayData
  • tst_QArrayData_StrictIterators
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QBrush
  • tst_QBuffer
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • ...
846
329-
330/*!-
331 \internal-
332 Unregisters a category object.-
333*/-
334void QLoggingRegistry::unregisterCategory(QLoggingCategory *cat)-
335{-
336 QMutexLocker locker(&registryMutex);-
337 categories.remove(cat);-
338}
executed 1425 times by 307 tests: end of block
Executed by:
  • tst_QLogging
  • tst_QLoggingRegistry
  • tst_QNoDebug
  • tst_compiler - unknown status
  • tst_gestures - unknown status
  • tst_lancelot - unknown status
  • tst_languagechange - unknown status
  • tst_largefile - unknown status
  • tst_modeltest - unknown status
  • tst_networkselftest - unknown status
  • tst_platformsocketengine - unknown status
  • tst_q_func_info - unknown status
  • tst_qabstractbutton - unknown status
  • tst_qabstractitemview - unknown status
  • tst_qabstractprintdialog - unknown status
  • tst_qabstractproxymodel - unknown status
  • tst_qabstractscrollarea - unknown status
  • tst_qabstractslider - unknown status
  • tst_qabstractspinbox - unknown status
  • tst_qabstracttextdocumentlayout - unknown status
  • tst_qaccessibility - unknown status
  • tst_qaction - unknown status
  • tst_qactiongroup - unknown status
  • tst_qanimationgroup - unknown status
  • tst_qapplication - unknown status
  • ...
1425
339-
340/*!-
341 \internal-
342 Installs logging rules as specified in \a content.-
343 */-
344void QLoggingRegistry::setApiRules(const QString &content)-
345{-
346 QLoggingSettingsParser parser;-
347 parser.setSection(QStringLiteral("Rules"));
executed 24019 times by 2 tests: return qstring_literal_temp;
Executed by:
  • tst_QLogging
  • tst_QLoggingRegistry
24019
348 parser.setContent(content);-
349-
350 if (qtLoggingDebug())
qtLoggingDebug()Description
TRUEnever evaluated
FALSEevaluated 24019 times by 2 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
0-24019
351 debugMsg("Loading logging rules set by QLoggingCategory::setFilterRules ...");
never executed: QMessageLogger(__FILE__, 351, __FUNCTION__, "qt.core.logging").debug("Loading logging rules set by QLoggingCategory::setFilterRules ...");
0
352-
353 const QMutexLocker locker(&registryMutex);-
354-
355 apiRules = parser.rules();-
356-
357 updateRules();-
358}
executed 24019 times by 2 tests: end of block
Executed by:
  • tst_QLogging
  • tst_QLoggingRegistry
24019
359-
360/*!-
361 \internal-
362 Activates a new set of logging rules for the default filter.-
363-
364 (The caller must lock registryMutex to make sure the API is thread safe.)-
365*/-
366void QLoggingRegistry::updateRules()-
367{-
368 rules = qtConfigRules + configRules + apiRules + envRules;-
369-
370 foreach (QLoggingCategory *cat, categories.keys())-
371 (*categoryFilter)(cat);
executed 216136 times by 2 tests: (*categoryFilter)(cat);
Executed by:
  • tst_QLogging
  • tst_QLoggingRegistry
216136
372}
executed 24025 times by 2 tests: end of block
Executed by:
  • tst_QLogging
  • tst_QLoggingRegistry
24025
373-
374/*!-
375 \internal-
376 Installs a custom filter rule.-
377*/-
378QLoggingCategory::CategoryFilter-
379QLoggingRegistry::installFilter(QLoggingCategory::CategoryFilter filter)-
380{-
381 QMutexLocker locker(&registryMutex);-
382-
383 if (filter == 0)
filter == 0Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QLogging
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QLogging
3-4
384 filter = defaultCategoryFilter;
executed 3 times by 1 test: filter = defaultCategoryFilter;
Executed by:
  • tst_QLogging
3
385-
386 QLoggingCategory::CategoryFilter old = categoryFilter;-
387 categoryFilter = filter;-
388-
389 foreach (QLoggingCategory *cat, categories.keys())-
390 (*categoryFilter)(cat);
executed 22 times by 1 test: (*categoryFilter)(cat);
Executed by:
  • tst_QLogging
22
391-
392 return old;
executed 7 times by 1 test: return old;
Executed by:
  • tst_QLogging
7
393}-
394-
395QLoggingRegistry *QLoggingRegistry::instance()-
396{-
397 return qtLoggingRegistry();
executed 244159 times by 547 tests: return qtLoggingRegistry();
Executed by:
  • tst_Compiler
  • tst_Gestures
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QArrayData
  • tst_QArrayData_StrictIterators
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QBrush
  • tst_QBuffer
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • ...
244159
398}-
399-
400/*!-
401 \internal-
402 Updates category settings according to rules.-
403-
404 As a category filter, it is run with registryMutex held.-
405*/-
406void QLoggingRegistry::defaultCategoryFilter(QLoggingCategory *cat)-
407{-
408 QLoggingRegistry *reg = QLoggingRegistry::instance();-
409 Q_ASSERT(reg->categories.contains(cat));-
410 QtMsgType enableForLevel = reg->categories.value(cat);-
411-
412 // NB: note that the numeric values of the Qt*Msg constants are-
413 // not in severity order.-
414 bool debug = (enableForLevel == QtDebugMsg);-
415 bool info = debug || (enableForLevel == QtInfoMsg);
debugDescription
TRUEevaluated 168952 times by 243 tests
Evaluated by:
  • tst_Compiler
  • tst_Gestures
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QArrayData
  • tst_QArrayData_StrictIterators
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QBrush
  • tst_QBuffer
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • ...
FALSEevaluated 48041 times by 1 test
Evaluated by:
  • tst_QLogging
(enableForLevel == QtInfoMsg)Description
TRUEevaluated 24020 times by 1 test
Evaluated by:
  • tst_QLogging
FALSEevaluated 24021 times by 1 test
Evaluated by:
  • tst_QLogging
24020-168952
416 bool warning = info || (enableForLevel == QtWarningMsg);
infoDescription
TRUEevaluated 192972 times by 243 tests
Evaluated by:
  • tst_Compiler
  • tst_Gestures
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QArrayData
  • tst_QArrayData_StrictIterators
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QBrush
  • tst_QBuffer
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • ...
FALSEevaluated 24021 times by 1 test
Evaluated by:
  • tst_QLogging
(enableForLeve... QtWarningMsg)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QLogging
FALSEevaluated 24020 times by 1 test
Evaluated by:
  • tst_QLogging
1-192972
417 bool critical = warning || (enableForLevel == QtCriticalMsg);
warningDescription
TRUEevaluated 192973 times by 243 tests
Evaluated by:
  • tst_Compiler
  • tst_Gestures
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QArrayData
  • tst_QArrayData_StrictIterators
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QBrush
  • tst_QBuffer
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • ...
FALSEevaluated 24020 times by 1 test
Evaluated by:
  • tst_QLogging
(enableForLeve...QtCriticalMsg)Description
TRUEnever evaluated
FALSEevaluated 24020 times by 1 test
Evaluated by:
  • tst_QLogging
0-192973
418-
419 // hard-wired implementation of-
420 // qt.*.debug=false-
421 // qt.debug=false-
422 if (const char *categoryName = cat->categoryName()) {
const char *ca...categoryName()Description
TRUEevaluated 216993 times by 243 tests
Evaluated by:
  • tst_Compiler
  • tst_Gestures
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QArrayData
  • tst_QArrayData_StrictIterators
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QBrush
  • tst_QBuffer
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • ...
FALSEnever evaluated
0-216993
423 // == "qt" or startsWith("qt.")-
424 if (strcmp(categoryName, "qt") == 0 || strncmp(categoryName, "qt.", 3) == 0)
strcmp(categor...me, "qt") == 0Description
TRUEnever evaluated
FALSEevaluated 216993 times by 243 tests
Evaluated by:
  • tst_Compiler
  • tst_Gestures
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QArrayData
  • tst_QArrayData_StrictIterators
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QBrush
  • tst_QBuffer
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • ...
strncmp(catego..."qt.", 3) == 0Description
TRUEevaluated 360 times by 137 tests
Evaluated by:
  • tst_Gestures
  • tst_ModelTest
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QApplication
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDataWidgetMapper
  • tst_QDateTimeEdit
  • tst_QDesktopWidget
  • tst_QDial
  • ...
FALSEevaluated 216633 times by 160 tests
Evaluated by:
  • tst_Compiler
  • tst_Gestures
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QArrayData
  • tst_QArrayData_StrictIterators
  • tst_QBoxLayout
  • tst_QBrush
  • tst_QBuffer
  • tst_QByteArray
  • tst_QColor
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLineParser
  • tst_QCompleter
  • tst_QDBusInterface
  • tst_QDBusLocalCalls
  • tst_QDBusMarshall
  • tst_QDBusMetaType
  • ...
0-216993
425 debug = false;
executed 360 times by 137 tests: debug = false;
Executed by:
  • tst_Gestures
  • tst_ModelTest
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QApplication
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDataWidgetMapper
  • tst_QDateTimeEdit
  • tst_QDesktopWidget
  • tst_QDial
  • ...
360
426 }
executed 216993 times by 243 tests: end of block
Executed by:
  • tst_Compiler
  • tst_Gestures
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QArrayData
  • tst_QArrayData_StrictIterators
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QBrush
  • tst_QBuffer
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • ...
216993
427-
428 QString categoryName = QLatin1String(cat->categoryName());-
429 foreach (const QLoggingRule &item, reg->rules) {-
430 int filterpass = item.pass(categoryName, QtDebugMsg);-
431 if (filterpass != 0)
filterpass != 0Description
TRUEevaluated 72079 times by 2 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
FALSEevaluated 144381 times by 1 test
Evaluated by:
  • tst_QLogging
72079-144381
432 debug = (filterpass > 0);
executed 72079 times by 2 tests: debug = (filterpass > 0);
Executed by:
  • tst_QLogging
  • tst_QLoggingRegistry
72079
433 filterpass = item.pass(categoryName, QtInfoMsg);-
434 if (filterpass != 0)
filterpass != 0Description
TRUEevaluated 72067 times by 2 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
FALSEevaluated 144393 times by 1 test
Evaluated by:
  • tst_QLogging
72067-144393
435 info = (filterpass > 0);
executed 72067 times by 2 tests: info = (filterpass > 0);
Executed by:
  • tst_QLogging
  • tst_QLoggingRegistry
72067
436 filterpass = item.pass(categoryName, QtWarningMsg);-
437 if (filterpass != 0)
filterpass != 0Description
TRUEevaluated 72067 times by 2 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
FALSEevaluated 144393 times by 1 test
Evaluated by:
  • tst_QLogging
72067-144393
438 warning = (filterpass > 0);
executed 72067 times by 2 tests: warning = (filterpass > 0);
Executed by:
  • tst_QLogging
  • tst_QLoggingRegistry
72067
439 filterpass = item.pass(categoryName, QtCriticalMsg);-
440 if (filterpass != 0)
filterpass != 0Description
TRUEevaluated 72066 times by 2 tests
Evaluated by:
  • tst_QLogging
  • tst_QLoggingRegistry
FALSEevaluated 144394 times by 1 test
Evaluated by:
  • tst_QLogging
72066-144394
441 critical = (filterpass > 0);
executed 72066 times by 2 tests: critical = (filterpass > 0);
Executed by:
  • tst_QLogging
  • tst_QLoggingRegistry
72066
442 }
executed 216460 times by 2 tests: end of block
Executed by:
  • tst_QLogging
  • tst_QLoggingRegistry
216460
443-
444 cat->setEnabled(QtDebugMsg, debug);-
445 cat->setEnabled(QtInfoMsg, info);-
446 cat->setEnabled(QtWarningMsg, warning);-
447 cat->setEnabled(QtCriticalMsg, critical);-
448}
executed 216993 times by 243 tests: end of block
Executed by:
  • tst_Compiler
  • tst_Gestures
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QArrayData
  • tst_QArrayData_StrictIterators
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QBrush
  • tst_QBuffer
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • ...
216993
449-
450-
451QT_END_NAMESPACE-
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9