summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qloggingregistry.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Update copyright headersJani Heikkinen2015-02-111-7/+7
| | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* Add QtInfoMsgKai Koehne2015-01-091-1/+10
| | | | | | | | | | | | | | Add an 'info' message type that can be used for messages that are neither warnings (QtWarningMsg), nor for debugging only (QtDebugMsg). This is useful mainly for applications that do not have to adhere to the 'do not print anything by default' paradigm that we have for the Qt libraries itself. [ChangeLog][QtCore][Logging] QtInfoMsg got added as a new QtMsgType. Use the new qInfo(), qCInfo() macros to log to it. Change-Id: I810995d63de46c41a9a99a34d37c0d417fa87a05 Reviewed-by: Jason McDonald <macadder1@gmail.com>
* Fix undefined behavior in QLoggingRegistry::defaultCategoryFilter()Marc Mutz2014-10-171-3/+5
| | | | | | | | | | | | | | | | | | | | | | Report by asan: READ of size 2 at 0x00000041dd40 thread T0 #0 0x2af097b84da6 in QLoggingRegistry::defaultCategoryFilter(QLoggingCategory*) (lib/libQt5Core.so.5+0x566da6) #1 0x2af097b8387b in QLoggingRegistry::registerCategory(QLoggingCategory*, QtMsgType) (lib/libQt5Core.so.5+0x56587b) #2 0x4067f7 in tst_QLogging::QLoggingCategory_categoryName() tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp:238 <snip> 0x00000041dd41 is located 0 bytes to the right of global variable '*.LC115' defined in 'tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp' (0x41dd40) of size 1 '*.LC115' is ascii string '' At face value, memcmp("", "qt", 2) should not return 0, but since the code invokes undefined behavior, the compiler can do whatever it wants, including returning 0 here, further proving the fact that there are *no* benign cases of undefined behavior. Change-Id: I0c38622c47d1dcea450ea549370be1673b47b18d Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Removing a few unneeded "? true : false"Alessandro Portale2014-10-091-3/+3
| | | | | | | Change-Id: Ib13f0ddd65fe78f5559f343f2fc30756b1d3ef76 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Update license headers and add new license filesMatti Paaso2014-09-241-18/+10
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* Remove normalization of "default" categoryKai Koehne2014-07-301-1/+0
| | | | | | | | | | | | Commit d61e774307819 got rid of the special handling of the 'default' category in the qloggingregistry, so we don't need the private header file anymore, nor does it gain us anything to 'normalize' all default categories to one string. Change-Id: I027b4b82ff915428287432f39f76b4e719cf7874 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
* Support setting a default severity level for QLoggingCategoryKai Koehne2014-07-231-14/+17
| | | | | | | | | | | | | | | | | | | | | | | | | Allow to alter the default configuration for categories by passing a message type: All message types with lower severity are disabled in this category. This is useful for libraries, which shouldn't mess with the category registry itself: Setting rules, a category filter ... might cause conflicts and ordering problems, so this API should be reserved to the specific application. For the Qt categories, we have code in the default category filter that disables the 'debug' category. However, this is hardcoded, and there's no way so far for other libraries to get the same behavior. With this patch one can get the same behavior: Q_LOGGING_CATEGORY(DRIVER_USB_EVENTS, "driver.usb.events", QtWarningMsg); [ChangeLog][QtCore][Logging] Added QtMsgType argument to QLoggingCategory constructor and Q_LOGGING_CATEGORY macro that controls the default category configuration. Change-Id: Ib2902f755f9f7285d79888ec30e8f3cef95ae628 Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
* Be more specific in "Loading logging rules" debug outputKai Koehne2014-07-231-1/+1
| | | | | Change-Id: I8a6f1797cbcfabc6df76ce17115a678f729ac711 Reviewed-by: hjk <hjk121@nokiamail.com>
* Fix warnings about integer conversion in qloggingregistry.cpp.Friedemann Kleint2014-07-221-3/+3
| | | | | | | | | io\qloggingregistry.cpp(134) : warning C4267: 'argument' : conversion from 'size_t' to 'int', possible loss of data io\qloggingregistry.cpp(138) : warning C4267: 'argument' : conversion from 'size_t' to 'int', possible loss of data io\qloggingregistry.cpp(142) : warning C4267: 'argument' : conversion from 'size_t' to 'int', possible loss of data Change-Id: Ic9787aa8acb5cb4440c62bbb143f7c2b7fdad385 Reviewed-by: Kai Koehne <kai.koehne@digia.com>
* Improve debugging output for QLoggingCategoryKai Koehne2014-07-211-6/+6
| | | | | | | | | Make sure that the source the rules are loaded from is printed before any syntax errors. Change-Id: Id7ced1a346dd0d8501eab93ac00e1f432ca6b703 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: hjk <hjk121@nokiamail.com>
* Logging: Be also more strict with value of logging ruleKai Koehne2014-04-031-5/+8
| | | | | | | | | | | | Only accept lower-case "true" and "false", as documented. The old check didn't match either the documentation, nor the QSettings/ QVariant behavior (where, for a boolean value, any lower-cased content that not empty, "0" or "false" is considered true). Change-Id: I317d29c16a27f862001b9dff02e8298df8acf5a6 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
* Logging: Remove PatternFlag::Invalid from QLoggingRuleKai Koehne2014-03-201-5/+2
| | | | | | | | | | | The flag is not orthogonal to the rest, and e.g. checking with flags & Invalid will fail. Rather make it explicit by comparing with 0. Change-Id: I428d5e71f5ecd05f61d543aaa78532548ef93d5a Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* Print when logging rule is invalid.Kai Koehne2014-03-201-1/+5
| | | | | | | Print a warning when an invalid logging rule is parsed. Change-Id: I3bf9a6df4053d36b3803652b2faa86168d5222bc Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* Logging: Let user configure rules via QT_LOGGING_RULESKai Koehne2014-03-131-1/+9
| | | | | | | | | | | | Check also for rules set in an environment variable QT_LOGGING_RULES. This makes it even more convenient to set rules e.g. for just one run of an application, without having to create a logging configuration file. It is also more in place with the current way we enable/disable debugging of parts of Qt via environment variables. Change-Id: I4d05976f2b6c12bca472552ffa22345475cd01de Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com> Reviewed-by: Tomasz Olszak <olszak.tomasz@gmail.com>
* Optionally print from where logging rules are loadedKai Koehne2014-03-131-0/+23
| | | | | | | | | | | | | | Tell the user from where logging configurations are loaded from if the QT_LOGGING_DEBUG environment variable is set. This allows 'debugging' of the logging rules database, because it's very simple to e.g. silence all debug messages by adding a logging configuration file somewhere, and forget about it. Change-Id: Iee34031d531462060b5603e2210e01fd40952c63 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Jerome Pasion <jerome.pasion@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Use QStringRef for parsing of logging rulesKai Koehne2014-03-131-13/+21
| | | | | | | | Use QStringRef to speed up the parsing of the left side of logging rules. Change-Id: Idd4d75496e3865d092f2802c45928a414c14c615 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Make parsing of categories in logging rules more strictKai Koehne2014-03-131-9/+9
| | | | | | | Do not accept rules with wildcards in the middle. Change-Id: If6fa71629c46bc4127aa8bd475643bc0e8a9f57c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Make parsing of categories in logging rules consistent.Kai Koehne2014-03-131-46/+44
| | | | | | | | | | | | | | | | | | | | | | | The documentation says that the left side of a logging rule has the syntax <category>[.<type>] with optional wildcard '*' as the first or the last character (or at both positions. However, so far we didn't allow qt.*.debug But what we did allow is implicit dropping of trailing '.', e.g. qt.* matched also 'qt' Fix these by splitting up the '.type' in advance, and then do string matching only on the 'real' category names. Change-Id: Iab50ad0fc673464e870f5ab8dfb3245d829b3107 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Logging: Change 'rules' section name to 'Rules'Kai Koehne2014-02-261-2/+2
| | | | | | | | | This is more consistent with e.g. qt.conf, where section names also start with an upper case character. Change-Id: I9ddaf72baeb9334d081807412512242d5d46cbbf Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
* Allow configuration of logging rules from file systemKai Koehne2014-02-111-28/+101
| | | | | | | | | | | | | | | | | | | | Allow configuration of logging rules from outside of the application, either through a configuration file (.config/QtProject/qtlogging.ini), or through a file specified by a QT_LOGGING_CONF environment variable. The logging rules from the different sources are concatenated: First the rules from QtProject/qtlogging.ini are applied, then QLoggingCategory::setLoggingRules(), finally from the environment. This allows an application to overwrite/augment the system wide rules, and in turn that can be tailored for a specific run by setting a configuration in the environment variable. [ChangeLog][QtCore][Logging] The logging framework can now be configured with an .ini file. Change-Id: I442efde1b7e0a2ebe135c6f6e0a4b656483fe4b1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Print qCDebugs in arbitrary categories by defaultGiorgos Tsiapaliokas2014-02-101-2/+6
| | | | | | | | | | | The debug output of all categories will be visible by default, except from the "qt.*" categories. "qt.*" categories are private and their default debug output will be hidden. [ChangeLog][QtCore][Logging] Enable qCDebug's for all categories except qt one's Change-Id: Ibe147c8bbe0835a63b3de782288b9c3251321d8f Reviewed-by: Kai Koehne <kai.koehne@digia.com>
* Revert "Add tracing to logging framework"Kai Koehne2013-11-071-8/+0
| | | | | | | | | | | | | | | | | | | The tracing API still misses some real-world exposure. Let's re-do this in dev to have more time. This reverts parts of following commits: 466e0dff4bb686e51d0ab3f905631fcb7dd8bfef 7a47aebe9ed41d6cd9c9bcd45758d4d553668e99 a652bab6a7ebf78b029fea95c2801deb6f4f524a 8f0654ceb878b6c8a08c7f5b790027c26e007c13 4162522edd9d31bd2798ab37f083adff818d886e 32f27b4367c4e042a3f0cda671579494e31c1d69 9ff81bdc1ab4e3d14914192cd63ae625a507fe90 Change-Id: If97340c37b8b3363f597683336a8390d5ff386f1 Reviewed-by: hjk <hjk121@nokiamail.com> Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
* Add tracing to logging frameworkhjk2013-09-251-0/+8
| | | | | | | | | Change-Id: I4d5b9a24a214785019ff1238c1790ead79205b15 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@digia.com> Reviewed-by: Topi Reiniƶ <topi.reinio@digia.com> Reviewed-by: Robin Burchell <robin+qt@viroteck.net> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
* Import qlogger frameworkKai Koehne2013-09-201-0/+312
Merge most parts of the qlogger framework from git://gitorious.org/qtplayground/qlogger.git The categorized logging feature is a replacement for qDebug, qWarning and friends. With logging statements in an app/library, a developer can turn on the statements they care about and turn off the ones they don't. Most work for this was done by Wolfgang Beck and Lincoln Ramsay. Task-number: QTBUG-25694 Change-Id: Ib0cdfbbf3694f86ad9ec553b2ea36f09a477cded Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>