qloggingcategory.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/corelib/io/qloggingcategory.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 "qloggingcategory.h"-
35#include "qloggingregistry_p.h"-
36-
37QT_BEGIN_NAMESPACE-
38-
39const char qtDefaultCategoryName[] = "default";-
40-
41Q_GLOBAL_STATIC_WITH_ARGS(QLoggingCategory, qtDefaultCategory,
executed 388 times by 161 tests: end of block
Executed by:
  • tst_compiler - unknown status
  • tst_gestures - 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_qabstractitemview - unknown status
  • tst_qaccessibility - unknown status
  • tst_qanimationgroup - unknown status
  • tst_qapplication - unknown status
  • tst_qarraydata - unknown status
  • tst_qarraydata_strictiterators - unknown status
  • tst_qboxlayout - unknown status
  • tst_qbrush - unknown status
  • tst_qbuffer - unknown status
  • tst_qbytearray - unknown status
  • tst_qcolor - unknown status
  • tst_qcolumnview - unknown status
  • tst_qcombobox - unknown status
  • tst_qcommandlineparser - unknown status
  • tst_qcompleter - unknown status
  • tst_qdatastream - unknown status
  • tst_qdate - unknown status
  • tst_qdatetime - unknown status
  • ...
executed 388 times by 161 tests: guard.store(QtGlobalStatic::Destroyed);
Executed by:
  • tst_compiler - unknown status
  • tst_gestures - 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_qabstractitemview - unknown status
  • tst_qaccessibility - unknown status
  • tst_qanimationgroup - unknown status
  • tst_qapplication - unknown status
  • tst_qarraydata - unknown status
  • tst_qarraydata_strictiterators - unknown status
  • tst_qboxlayout - unknown status
  • tst_qbrush - unknown status
  • tst_qbuffer - unknown status
  • tst_qbytearray - unknown status
  • tst_qcolor - unknown status
  • tst_qcolumnview - unknown status
  • tst_qcombobox - unknown status
  • tst_qcommandlineparser - unknown status
  • tst_qcompleter - unknown status
  • tst_qdatastream - unknown status
  • tst_qdate - unknown status
  • tst_qdatetime - unknown status
  • ...
executed 215065 times by 159 tests: return &holder.value;
Executed 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
  • ...
guard.load() =...c::InitializedDescription
TRUEevaluated 388 times by 161 tests
Evaluated by:
  • tst_compiler - unknown status
  • tst_gestures - 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_qabstractitemview - unknown status
  • tst_qaccessibility - unknown status
  • tst_qanimationgroup - unknown status
  • tst_qapplication - unknown status
  • tst_qarraydata - unknown status
  • tst_qarraydata_strictiterators - unknown status
  • tst_qboxlayout - unknown status
  • tst_qbrush - unknown status
  • tst_qbuffer - unknown status
  • tst_qbytearray - unknown status
  • tst_qcolor - unknown status
  • tst_qcolumnview - unknown status
  • tst_qcombobox - unknown status
  • tst_qcommandlineparser - unknown status
  • tst_qcompleter - unknown status
  • tst_qdatastream - unknown status
  • tst_qdate - unknown status
  • tst_qdatetime - unknown status
  • ...
FALSEnever evaluated
0-215065
42 (qtDefaultCategoryName))-
43-
44#ifndef Q_ATOMIC_INT8_IS_SUPPORTED-
45static void setBoolLane(QBasicAtomicInt *atomic, bool enable, int shift)-
46{-
47 const int bit = 1 << shift;-
48-
49 if (enable)-
50 atomic->fetchAndOrRelaxed(bit);-
51 else-
52 atomic->fetchAndAndRelaxed(~bit);-
53}-
54#endif-
55-
56/*!-
57 \class QLoggingCategory-
58 \inmodule QtCore-
59 \since 5.2-
60-
61 \brief The QLoggingCategory class represents a category, or 'area' in the-
62 logging infrastructure.-
63-
64 QLoggingCategory represents a certain logging category - identified by a-
65 string - at runtime. A category can be configured to enable or disable-
66 logging of messages per message type. Whether a message type is enabled or-
67 not can be checked with the \l isDebugEnabled(), \l isInfoEnabled(),-
68 \l isWarningEnabled(), and \l isCriticalEnabled() methods.-
69-
70 All objects are meant to be configured by a common registry (see also-
71 \l{Configuring Categories}). Different objects can also represent the same-
72 category. It is therefore not recommended to export objects across module-
73 boundaries, nor to manipulate the objects directly, nor to inherit from-
74 QLoggingCategory.-
75-
76 \section1 Creating Category Objects-
77-
78 The Q_DECLARE_LOGGING_CATEGORY() and Q_LOGGING_CATEGORY() macros-
79 conveniently declare and create QLoggingCategory objects:-
80-
81 \snippet qloggingcategory/main.cpp 1-
82-
83 \note Category names are free text. However, to allow easy configuration-
84 of the categories using \l{Logging Rules} the names should follow some rules:-
85 \list-
86 \li Use letters and numbers only.-
87 \li Further structure categories into common areas by using dots.-
88 \li Avoid the category names \c{debug}, \c{info}, \c{warning}, and \c{critical}.-
89 \li Category names starting with \c{qt} are reserved for Qt modules.-
90 \endlist-
91-
92 \section1 Checking Category Configuration-
93-
94 QLoggingCategory provides \l isDebugEnabled(), \l isInfoEnabled(),-
95 \l isWarningEnabled(), \l isCriticalEnabled(), as well as \l isEnabled()-
96 to check whether messages for the given message type should be logged.-
97-
98 \note The qCDebug(), qCWarning(), qCCritical() macros prevent arguments-
99 from being evaluated if the respective message types are not enabled for the-
100 category, so explicit checking is not needed:-
101-
102 \snippet qloggingcategory/main.cpp 4-
103-
104 \section1 Default Category Configuration-
105-
106 Both the QLoggingCategory constructor and the Q_LOGGING_CATEGORY() macro-
107 accept an optional QtMsgType argument, which disables all message types with-
108 a lower severity. That is, a category declared with-
109-
110 \snippet qloggingcategory/main.cpp 5-
111-
112 will log messages of type \c QtWarningMsg, \c QtCriticalMsg, \c QtFatalMsg, but will-
113 ignore messages of type \c QtDebugMsg and \c QtInfoMsg.-
114-
115 If no argument is passed, all messages will be logged.-
116-
117 \section1 Configuring Categories-
118-
119 The default configuration of categories can be overridden either by setting logging-
120 rules, or by installing a custom filter.-
121-
122 \section2 Logging Rules-
123-
124 Logging rules allow logging for categories to be enabled or disabled in a-
125 flexible way. Rules are specified in text, where every line must have the-
126 format-
127-
128 \code-
129 <category>[.<type>] = true|false-
130 \endcode-
131-
132 \c <category> is the name of the category, potentially with \c{*} as a-
133 wildcard symbol as the first or last character (or at both positions).-
134 The optional \c <type> must be either \c debug, \c info, \c warning, or \c critical.-
135 Lines that do not fit this scheme are ignored.-
136-
137 Rules are evaluated in text order, from first to last. That is, if two rules-
138 apply to a category/type, the rule that comes later is applied.-
139-
140 Rules can be set via \l setFilterRules(). Since Qt 5.3, logging rules can also-
141 be set in the \c QT_LOGGING_RULES environment variable, and-
142 are automatically loaded from the \c [Rules] section of a logging-
143 configuration file. Such configuration files are looked up in the QtProject-
144 configuration directory, or explicitly set in a \c QT_LOGGING_CONF-
145 environment variable:-
146-
147 \code-
148 [Rules]-
149 *.debug=false-
150 driver.usb.debug=true-
151 \endcode-
152-
153 Rules set by \l setFilterRules() take precedence over rules specified-
154 in the QtProject configuration directory, and can, in turn, be-
155 overwritten by rules from the configuration file specified by-
156 \c QT_LOGGING_CONF, and rules set by \c QT_LOGGING_RULES.-
157-
158-
159 Since Qt 5.6, \c QT_LOGGING_RULES may contain multiple rules separated-
160 by semicolons:-
161-
162 \code-
163 QT_LOGGING_RULES="*.debug=false;driver.usb.debug=true"-
164 \endcode-
165-
166-
167 Order of evaluation:-
168 \list-
169 \li [QLibraryInfo::DataPath]/qtlogging.ini-
170 \li QtProject/qtlogging.ini-
171 \li \l setFilterRules()-
172 \li \c QT_LOGGING_CONF-
173 \li \c QT_LOGGING_RULES-
174 \endlist-
175-
176 The \c QtProject/qtlogging.ini file is looked up in all directories returned-
177 by QStandardPaths::GenericConfigLocation, e.g.-
178-
179 \list-
180 \li on \macos and iOS: \c ~/Library/Preferences-
181 \li on Unix: \c ~/.config, \c /etc/xdg-
182 \li on Windows: \c %LOCALAPPDATA%, \c %ProgramData%,-
183 \l QCoreApplication::applicationDirPath(),-
184 QCoreApplication::applicationDirPath() + \c "/data"-
185 \endlist-
186-
187 Set the \c QT_LOGGING_DEBUG environment variable to see from where-
188 logging rules are loaded.-
189-
190 \section2 Installing a Custom Filter-
191-
192 As a lower-level alternative to the text rules, you can also implement a-
193 custom filter via \l installFilter(). All filter rules are ignored in this-
194 case.-
195-
196 \section1 Printing the Category-
197-
198 Use the \c %{category} placeholder to print the category in the default-
199 message handler:-
200-
201 \snippet qloggingcategory/main.cpp 3-
202*/-
203-
204/*!-
205 Constructs a QLoggingCategory object with the provided \a category name.-
206 All message types for this category are enabled by default.-
207-
208 If \a category is \c{0}, the category name is changed to \c "default".-
209*/-
210QLoggingCategory::QLoggingCategory(const char *category)-
211 : d(0),-
212 name(0)-
213{-
214 init(category, QtDebugMsg);-
215}
executed 842 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
  • ...
842
216-
217/*!-
218 Constructs a QLoggingCategory object with the provided \a category name,-
219 and enables all messages with types more severe or equal than \a enableForLevel.-
220-
221 If \a category is \c{0}, the category name is changed to \c "default".-
222-
223 \since 5.4-
224*/-
225QLoggingCategory::QLoggingCategory(const char *category, QtMsgType enableForLevel)-
226 : d(0),-
227 name(0)-
228{-
229 init(category, enableForLevel);-
230}
executed 4 times by 1 test: end of block
Executed by:
  • tst_QLogging
4
231-
232void QLoggingCategory::init(const char *category, QtMsgType severityLevel)-
233{-
234 enabled.store(0x01010101); // enabledDebug = enabledWarning = enabledCritical = true;-
235-
236 if (category)
categoryDescription
TRUEevaluated 844 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 2 times by 1 test
Evaluated by:
  • tst_QLogging
2-844
237 name = category;
executed 844 times by 243 tests: name = category;
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
  • ...
844
238 else-
239 name = qtDefaultCategoryName;
executed 2 times by 1 test: name = qtDefaultCategoryName;
Executed by:
  • tst_QLogging
2
240-
241 if (QLoggingRegistry *reg = QLoggingRegistry::instance())
QLoggingRegist...ry::instance()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
242 reg->registerCategory(this, severityLevel);
executed 846 times by 243 tests: reg->registerCategory(this, severityLevel);
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
243}
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
244-
245/*!-
246 Destructs a QLoggingCategory object.-
247*/-
248QLoggingCategory::~QLoggingCategory()-
249{-
250 if (QLoggingRegistry *reg = QLoggingRegistry::instance())
QLoggingRegist...ry::instance()Description
TRUEevaluated 1425 times by 307 tests
Evaluated 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
  • ...
FALSEnever evaluated
0-1425
251 reg->unregisterCategory(this);
executed 1425 times by 307 tests: reg->unregisterCategory(this);
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
252}
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
253-
254/*!-
255 \fn const char *QLoggingCategory::categoryName() const-
256-
257 Returns the name of the category.-
258*/-
259-
260/*!-
261 \fn bool QLoggingCategory::isDebugEnabled() const-
262-
263 Returns \c true if debug messages should be shown for this category.-
264 Returns \c false otherwise.-
265-
266 \note The \l qCDebug() macro already does this check before executing any-
267 code. However, calling this method may be useful to avoid-
268 expensive generation of data that is only used for debug output.-
269*/-
270-
271-
272/*!-
273 \fn bool QLoggingCategory::isInfoEnabled() const-
274-
275 Returns \c true if informational messages should be shown for this category.-
276 Returns \c false otherwise.-
277-
278 \note The \l qCInfo() macro already does this check before executing any-
279 code. However, calling this method may be useful to avoid-
280 expensive generation of data that is only used for debug output.-
281-
282 \since 5.5-
283*/-
284-
285-
286/*!-
287 \fn bool QLoggingCategory::isWarningEnabled() const-
288-
289 Returns \c true if warning messages should be shown for this category.-
290 Returns \c false otherwise.-
291-
292 \note The \l qCWarning() macro already does this check before executing any-
293 code. However, calling this method may be useful to avoid-
294 expensive generation of data that is only used for debug output.-
295*/-
296-
297/*!-
298 \fn bool QLoggingCategory::isCriticalEnabled() const-
299-
300 Returns \c true if critical messages should be shown for this category.-
301 Returns \c false otherwise.-
302-
303 \note The \l qCCritical() macro already does this check before executing any-
304 code. However, calling this method may be useful to avoid-
305 expensive generation of data that is only used for debug output.-
306*/-
307-
308/*!-
309 Returns \c true if a message of type \a msgtype for the category should be-
310 shown. Returns \c false otherwise.-
311*/-
312bool QLoggingCategory::isEnabled(QtMsgType msgtype) const-
313{-
314 switch (msgtype) {-
315 case QtDebugMsg: return isDebugEnabled();
executed 3395 times by 72 tests: return isDebugEnabled();
Executed by:
  • tst_Compiler
  • tst_Gestures
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QApplication
  • tst_QArrayData
  • tst_QArrayData_StrictIterators
  • tst_QBrush
  • tst_QColumnView
  • tst_QDBusInterface
  • tst_QDate
  • tst_QDateTime
  • tst_QDebug
  • tst_QElapsedTimer
  • tst_QEventLoop
  • tst_QFileSystemWatcher
  • tst_QFtp
  • tst_QGraphicsScene
  • tst_QGuiEventLoop
  • tst_QGuiVariant
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QLocalSocket
  • ...
executed 3395 times by 72 tests: case QtDebugMsg:
Executed by:
  • tst_Compiler
  • tst_Gestures
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QApplication
  • tst_QArrayData
  • tst_QArrayData_StrictIterators
  • tst_QBrush
  • tst_QColumnView
  • tst_QDBusInterface
  • tst_QDate
  • tst_QDateTime
  • tst_QDebug
  • tst_QElapsedTimer
  • tst_QEventLoop
  • tst_QFileSystemWatcher
  • tst_QFtp
  • tst_QGraphicsScene
  • tst_QGuiEventLoop
  • tst_QGuiVariant
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QLocalSocket
  • ...
3395
316 case QtInfoMsg: return isInfoEnabled();
executed 90 times by 3 tests: return isInfoEnabled();
Executed by:
  • tst_QLogging
  • tst_qlogging - unknown status
  • tst_selftests - unknown status
executed 90 times by 3 tests: case QtInfoMsg:
Executed by:
  • tst_QLogging
  • tst_qlogging - unknown status
  • tst_selftests - unknown status
90
317 case QtWarningMsg: return isWarningEnabled();
executed 211506 times by 127 tests: return isWarningEnabled();
Executed by:
  • tst_Gestures
  • tst_LargeFile
  • tst_PlatformSocketEngine
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QBoxLayout
  • tst_QBrush
  • tst_QBuffer
  • tst_QByteArray
  • tst_QColor
  • tst_QComboBox
  • tst_QCommandLineParser
  • tst_QCompleter
  • tst_QDBusInterface
  • tst_QDBusLocalCalls
  • tst_QDBusMarshall
  • tst_QDBusMetaType
  • tst_QDataStream
  • tst_QDateTimeEdit
  • tst_QDebug
  • tst_QDesktopWidget
  • tst_QDialogButtonBox
  • tst_QDir
  • ...
executed 211506 times by 127 tests: case QtWarningMsg:
Executed by:
  • tst_Gestures
  • tst_LargeFile
  • tst_PlatformSocketEngine
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QBoxLayout
  • tst_QBrush
  • tst_QBuffer
  • tst_QByteArray
  • tst_QColor
  • tst_QComboBox
  • tst_QCommandLineParser
  • tst_QCompleter
  • tst_QDBusInterface
  • tst_QDBusLocalCalls
  • tst_QDBusMarshall
  • tst_QDBusMetaType
  • tst_QDataStream
  • tst_QDateTimeEdit
  • tst_QDebug
  • tst_QDesktopWidget
  • tst_QDialogButtonBox
  • tst_QDir
  • ...
211506
318 case QtCriticalMsg: return isCriticalEnabled();
executed 34 times by 4 tests: return isCriticalEnabled();
Executed by:
  • tst_QDebug
  • tst_QLogging
  • tst_qlogging - unknown status
  • tst_selftests - unknown status
executed 34 times by 4 tests: case QtCriticalMsg:
Executed by:
  • tst_QDebug
  • tst_QLogging
  • tst_qlogging - unknown status
  • tst_selftests - unknown status
34
319 case QtFatalMsg: return true;
executed 47 times by 2 tests: return true;
Executed by:
  • tst_QNetworkReply
  • tst_selftests - unknown status
executed 47 times by 2 tests: case QtFatalMsg:
Executed by:
  • tst_QNetworkReply
  • tst_selftests - unknown status
47
320 }-
321 return false;
never executed: return false;
0
322}-
323-
324/*!-
325 Changes the message type \a type for the category to \a enable.-
326-
327 \note Changes only affect the current QLoggingCategory object, and won't-
328 change the settings of other objects for the same category name.-
329 Use either \l setFilterRules() or \l installFilter() to change the-
330 configuration globally.-
331-
332 \note \c QtFatalMsg cannot be changed. It will always return \c true.-
333*/-
334void QLoggingCategory::setEnabled(QtMsgType type, bool enable)-
335{-
336 switch (type) {-
337#ifdef Q_ATOMIC_INT8_IS_SUPPORTED-
338 case QtDebugMsg: bools.enabledDebug.store(enable); break;
executed 217006 times by 243 tests: break;
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
  • ...
executed 217006 times by 243 tests: case QtDebugMsg:
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
  • ...
217006
339 case QtInfoMsg: bools.enabledInfo.store(enable); break;
executed 216993 times by 243 tests: break;
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
  • ...
executed 216993 times by 243 tests: case QtInfoMsg:
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
340 case QtWarningMsg: bools.enabledWarning.store(enable); break;
executed 216993 times by 243 tests: break;
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
  • ...
executed 216993 times by 243 tests: case QtWarningMsg:
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
341 case QtCriticalMsg: bools.enabledCritical.store(enable); break;
executed 216993 times by 243 tests: break;
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
  • ...
executed 216993 times by 243 tests: case QtCriticalMsg:
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
342#else-
343 case QtDebugMsg: setBoolLane(&enabled, enable, DebugShift); break;-
344 case QtInfoMsg: setBoolLane(&enabled, enable, InfoShift); break;-
345 case QtWarningMsg: setBoolLane(&enabled, enable, WarningShift); break;-
346 case QtCriticalMsg: setBoolLane(&enabled, enable, CriticalShift); break;-
347#endif-
348 case QtFatalMsg: break;
never executed: break;
never executed: case QtFatalMsg:
0
349 }-
350}
executed 867985 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
  • ...
867985
351-
352/*!-
353 \fn QLoggingCategory &QLoggingCategory::operator()()-
354-
355 Returns the object itself. This allows both a QLoggingCategory variable, and-
356 a factory method returning a QLoggingCategory, to be used in \l qCDebug(),-
357 \l qCWarning(), \l qCCritical() macros.-
358 */-
359-
360/*!-
361 \fn const QLoggingCategory &QLoggingCategory::operator()() const-
362-
363 Returns the object itself. This allows both a QLoggingCategory variable, and-
364 a factory method returning a QLoggingCategory, to be used in \l qCDebug(),-
365 \l qCWarning(), \l qCCritical() macros.-
366 */-
367-
368/*!-
369 Returns a pointer to the global category \c "default" that-
370 is used e.g. by qDebug(), qInfo(), qWarning(), qCritical(), qFatal().-
371-
372 \note The returned pointer may be null during destruction of-
373 static objects.-
374-
375 \note Ownership of the category is not transferred, do not-
376 \c delete the returned pointer.-
377-
378 */-
379QLoggingCategory *QLoggingCategory::defaultCategory()-
380{-
381 return qtDefaultCategory();
executed 215065 times by 159 tests: return qtDefaultCategory();
Executed 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
  • ...
215065
382}-
383-
384/*!-
385 \typedef QLoggingCategory::CategoryFilter-
386-
387 This is a typedef for a pointer to a function with the following-
388 signature:-
389-
390 \snippet qloggingcategory/main.cpp 20-
391-
392 A function with this signature can be installed with \l installFilter().-
393*/-
394-
395/*!-
396 Installs a function \a filter that is used to determine which categories-
397 and message types should be enabled. Returns a pointer to the previous-
398 installed filter.-
399-
400 Every QLoggingCategory object created is passed to the filter, and the-
401 filter is free to change the respective category configuration with-
402 \l setEnabled().-
403-
404 The filter might be called concurrently from different threads, and-
405 therefore has to be reentrant.-
406-
407 Example:-
408 \snippet qloggingcategory/main.cpp 21-
409-
410 An alternative way of configuring the default filter is via-
411 \l setFilterRules().-
412 */-
413QLoggingCategory::CategoryFilter-
414QLoggingCategory::installFilter(QLoggingCategory::CategoryFilter filter)-
415{-
416 return QLoggingRegistry::instance()->installFilter(filter);
executed 7 times by 1 test: return QLoggingRegistry::instance()->installFilter(filter);
Executed by:
  • tst_QLogging
7
417}-
418-
419/*!-
420 Configures which categories and message types should be enabled through a-
421 a set of \a rules.-
422-
423 Example:-
424-
425 \snippet qloggingcategory/main.cpp 2-
426-
427 \note The rules might be ignored if a custom category filter is installed-
428 with \l installFilter(), or if the user defined \c QT_LOGGING_CONF or \c QT_LOGGING_RULES-
429 environment variable.-
430*/-
431void QLoggingCategory::setFilterRules(const QString &rules)-
432{-
433 QLoggingRegistry::instance()->setApiRules(rules);-
434}
executed 24019 times by 2 tests: end of block
Executed by:
  • tst_QLogging
  • tst_QLoggingRegistry
24019
435-
436/*!-
437 \macro qCDebug(category)-
438 \relates QLoggingCategory-
439 \since 5.2-
440-
441 Returns an output stream for debug messages in the logging category-
442 \a category.-
443-
444 The macro expands to code that checks whether-
445 \l QLoggingCategory::isDebugEnabled() evaluates to \c true.-
446 If so, the stream arguments are processed and sent to the message handler.-
447-
448 Example:-
449-
450 \snippet qloggingcategory/main.cpp 10-
451-
452 \note Arguments are not processed if debug output for the category is not-
453 enabled, so do not rely on any side effects.-
454-
455 \sa qDebug()-
456*/-
457-
458/*!-
459 \macro qCDebug(category, const char *message, ...)-
460 \relates QLoggingCategory-
461 \since 5.3-
462-
463 Logs a debug message \a message in the logging category \a category.-
464 \a message might contain place holders that are replaced by additional-
465 arguments, similar to the C printf() function.-
466-
467 Example:-
468-
469 \snippet qloggingcategory/main.cpp 13-
470-
471 \note Arguments might not be processed if debug output for the category is-
472 not enabled, so do not rely on any side effects.-
473-
474 \sa qDebug()-
475*/-
476-
477/*!-
478 \macro qCInfo(category)-
479 \relates QLoggingCategory-
480 \since 5.5-
481-
482 Returns an output stream for informational messages in the logging category-
483 \a category.-
484-
485 The macro expands to code that checks whether-
486 \l QLoggingCategory::isInfoEnabled() evaluates to \c true.-
487 If so, the stream arguments are processed and sent to the message handler.-
488-
489 Example:-
490-
491 \snippet qloggingcategory/main.cpp qcinfo_stream-
492-
493 \note Arguments are not processed if debug output for the category is not-
494 enabled, so do not rely on any side effects.-
495-
496 \sa qInfo()-
497*/-
498-
499/*!-
500 \macro qCInfo(category, const char *message, ...)-
501 \relates QLoggingCategory-
502 \since 5.5-
503-
504 Logs an informational message \a message in the logging category \a category.-
505 \a message might contain place holders that are replaced by additional-
506 arguments, similar to the C printf() function.-
507-
508 Example:-
509-
510 \snippet qloggingcategory/main.cpp qcinfo_printf-
511-
512 \note Arguments might not be processed if debug output for the category is-
513 not enabled, so do not rely on any side effects.-
514-
515 \sa qInfo()-
516*/-
517-
518/*!-
519 \macro qCWarning(category)-
520 \relates QLoggingCategory-
521 \since 5.2-
522-
523 Returns an output stream for warning messages in the logging category-
524 \a category.-
525-
526 The macro expands to code that checks whether-
527 \l QLoggingCategory::isWarningEnabled() evaluates to \c true.-
528 If so, the stream arguments are processed and sent to the message handler.-
529-
530 Example:-
531-
532 \snippet qloggingcategory/main.cpp 11-
533-
534 \note Arguments are not processed if warning output for the category is not-
535 enabled, so do not rely on any side effects.-
536-
537 \sa qWarning()-
538*/-
539-
540/*!-
541 \macro qCWarning(category, const char *message, ...)-
542 \relates QLoggingCategory-
543 \since 5.3-
544-
545 Logs a warning message \a message in the logging category \a category.-
546 \a message might contain place holders that are replaced by additional-
547 arguments, similar to the C printf() function.-
548-
549 Example:-
550-
551 \snippet qloggingcategory/main.cpp 14-
552-
553 \note Arguments might not be processed if warning output for the category is-
554 not enabled, so do not rely on any side effects.-
555-
556 \sa qWarning()-
557*/-
558-
559/*!-
560 \macro qCCritical(category)-
561 \relates QLoggingCategory-
562 \since 5.2-
563-
564 Returns an output stream for critical messages in the logging category-
565 \a category.-
566-
567 The macro expands to code that checks whether-
568 \l QLoggingCategory::isCriticalEnabled() evaluates to \c true.-
569 If so, the stream arguments are processed and sent to the message handler.-
570-
571 Example:-
572-
573 \snippet qloggingcategory/main.cpp 12-
574-
575 \note Arguments are not processed if critical output for the category is not-
576 enabled, so do not rely on any side effects.-
577-
578 \sa qCritical()-
579*/-
580-
581/*!-
582 \macro qCCritical(category, const char *message, ...)-
583 \relates QLoggingCategory-
584 \since 5.3-
585-
586 Logs a critical message \a message in the logging category \a category.-
587 \a message might contain place holders that are replaced by additional-
588 arguments, similar to the C printf() function.-
589-
590 Example:-
591-
592 \snippet qloggingcategory/main.cpp 15-
593-
594 \note Arguments might not be processed if critical output for the category-
595 is not enabled, so do not rely on any side effects.-
596-
597 \sa qCritical()-
598*/-
599/*!-
600 \macro Q_DECLARE_LOGGING_CATEGORY(name)-
601 \sa Q_LOGGING_CATEGORY()-
602 \relates QLoggingCategory-
603 \since 5.2-
604-
605 Declares a logging category \a name. The macro can be used to declare-
606 a common logging category shared in different parts of the program.-
607-
608 This macro must be used outside of a class or method.-
609*/-
610-
611/*!-
612 \macro Q_LOGGING_CATEGORY(name, string)-
613 \sa Q_DECLARE_LOGGING_CATEGORY()-
614 \relates QLoggingCategory-
615 \since 5.2-
616-
617 Defines a logging category \a name, and makes it configurable under the-
618 \a string identifier. By default, all message types are enabled.-
619-
620 Only one translation unit in a library or executable can define a category-
621 with a specific name.-
622-
623 This macro must be used outside of a class or method.-
624*/-
625-
626/*!-
627 \macro Q_LOGGING_CATEGORY(name, string, msgType)-
628 \sa Q_DECLARE_LOGGING_CATEGORY()-
629 \relates QLoggingCategory-
630 \since 5.4-
631-
632 Defines a logging category \a name, and makes it configurable under the-
633 \a string identifier. By default, messages of QtMsgType \a msgType-
634 and more severe are enabled, types with a lower severity are disabled.-
635-
636 Only one translation unit in a library or executable can define a category-
637 with a specific name.-
638-
639 This macro must be used outside of a class or method. It is only defined-
640 if variadic macros are supported.-
641*/-
642-
643QT_END_NAMESPACE-
Source codeSwitch to Preprocessed file

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