summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qloggingcategory.h
Commit message (Collapse)AuthorAgeFilesLines
* Updated license headersJani Heikkinen2016-01-151-14/+20
| | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* 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>
* Get rid of QT_NO_QWARNING_MACROKai Koehne2015-01-091-1/+1
| | | | | | | Just use QT_NO_QDEBUG_MACRO, like we do already for qInfo. Change-Id: I4b2ef68427fbe6f253fe02a3ab161fa25186e834 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add QtInfoMsgKai Koehne2015-01-091-3/+14
| | | | | | | | | | | | | | 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>
* Logging: Disable tracking of debug source info for release buildsKai Koehne2014-10-011-3/+4
| | | | | | | | | | | | | | | Tracking the file, line, function means the information has to be stored in the binaries, enlarging the size. It also might be a surprise to some commercial customers that their internal file & function names are 'leaked'. Therefore we enable it for debug builds only. [ChangeLog][QtCore][Logging] File, line, function information are not recorded anymore for logging statements in release builds. Set QT_MESSAGELOGCONTEXT explicitly to enable recording in all configurations. Change-Id: I454bdb42bcf5b5a8de6507f29f2a61109dca9b91 Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@digia.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>
* Support setting a default severity level for QLoggingCategoryKai Koehne2014-07-231-8/+18
| | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Introduce Q_DECL_UNUSED_MEMBER for clangKai Koehne2014-07-231-3/+3
| | | | | | | | | | | | | | | | Since version 3.2, clang warns about unused member variables (-Wunused-private-field). Marking such members with Q_DECL_UNUSED_MEMBER will silence this warning. This is a cleaner way than using Q_UNUSED() somewhere in the class methods (like we did previously in qloggingcategory.cpp). It mirrors Q_DECL_UNUSED for unused variables, which however can't be used unconditionally for member variables because e.g. gcc will complain. Change-Id: I2afff683a7c3bae3bdcd684e5085a643887bb2a0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: hjk <hjk121@nokiamail.com>
* Fix data race on QLoggingCategory when using qDebug from multiple threadsDavid Faure2014-06-201-8/+27
| | | | | | | setEnabled() would race with isEnabled()/isDebugEnabled()/etc. Change-Id: I2004cba81d5417a634b97f5c2f98d3a4ab71770d Reviewed-by: David Faure <david.faure@kdab.com>
* Add const overload for QLoggingCategory::operator()()Kai Koehne2014-02-151-0/+1
| | | | | | | | | | | | | | | | | | | | Change 85e57653 caused a compile error for code that does Q_DECLARE_LOGGING_CATEGORY(cat); //.. qCDebug(cat()) << // ... error: C3848: expression having type 'const QLoggingCategory' would lose some const-volatile qualifiers in order to call 'QLoggingCategory &QLoggingCategory::operator ()(void)' This is a regression from Qt 5.2. Fix the error by adding a const version of operator()(). Change-Id: I2fb04f2e155962adee0f98089fc5a159000bef56 Reviewed-by: Alex Blasche <alexander.blasche@digia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Revert "Logging: Don't use for loop in qCDebug macros"Kai Koehne2014-02-151-3/+3
| | | | | | | | | | | | | | | | | | The use of if {} else {} in the macro causes compiler warnings about "ambiguous 'else'" if qCDebug is used in an if / else without brackets. Revert to the for loop, but make the variable name less likely to clash. This reverts commit bab5f5873680aa3c5a22d94da112aafd2b0b53d3. Task-number: QTBUG-36605 Change-Id: Ie4b075b63b83b7f8a2ad61437b7bf3e6a6c0177a Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Let Q_DECLARE_LOGGING_CATEGORY and Q_LOGGING_CATEGORY return a const referenceKai Koehne2014-02-141-3/+3
| | | | | | | | | | | | | In general QLoggingCategory should be treated as a const object that's configured by the backend. The only legitimate place where user code should call setEnabled is in a CategoryFilter ... [ChangeLog][QtCore][Logging] Make Q_LOGGING_CATEGORY and Q_DECLARE_LOGGING_CATEGORY return a const object. Change-Id: I6140442ab48286e05cd3b55064a502bbe6dfb16a Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Logging: Don't use for loop in qCDebug macrosKai Koehne2014-02-041-3/+3
| | | | | | | | | | | | The local 'enabled' variable might cause dubious MSVC warnings if a local variable name 'enabled' exists. Just replace the whole loop with the if (...); else idiom, as Thiago once suggested on the mailing list. Task-number: QTBUG-36605 Change-Id: I0b8959a29d4432296961493fe2b7827c5b860d00 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* Allow printf style for qCDebug, qCWarning, qCCritical macrosKai Koehne2014-01-211-6/+17
| | | | | | | | | | | | | | | | | Add support for using qCDebug and friends in the 'printf style' way. This allows an almost mechanical conversion of existing qDebug, qWarning, qCritical macros, and allows avoiding the size overhead the streaming style incurs (mostly due to inlined QDebug code). To handle this gracefully we require variadic macros (part of C++11/C99). For compilers not supporting variadic macros we fall back to checking the category in QMessageLogger. [ChangeLog][QtCore][Logging] Allow qCDebug macros to be used in a printf style. Change-Id: I5a8fb135dca504e1d621bb67bf4b2a50c73d41b9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Revert "Add tracing to logging framework"Kai Koehne2013-11-071-72/+2
| | | | | | | | | | | | | | | | | | | 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>
* Use Q_UNLIKELY in qCDebug, qCTraceKai Koehne2013-10-301-2/+2
| | | | | | | | By default debug, trace is disabled, so this can be marked as unlikely. Change-Id: I221a688c953c1ff1fdfda65d2d99457785d3ff47 Reviewed-by: hjk <hjk121@nokiamail.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Reserve some space for future use in QLoggingCategoryKai Koehne2013-10-241-0/+4
| | | | | | | | | Currently Qt offers only debug, warning, critical message types for general use. Most logging frameworks offer more ... let's save some space for future message types. Change-Id: Icb4333da5c8f5277fd10d8a01b06d95369662bdc Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Let QLoggingCategory::defaultCategory return a pointerhjk2013-10-111-1/+1
| | | | | | | | The pointer can be null. Going trough the reference invokes undefined behavior here. Change-Id: Ia84e4e732cdcbbaee0f5f0679765d18069ea8b2d Reviewed-by: Kai Koehne <kai.koehne@digia.com>
* Replace QLoggingCategory::isEnabled by non-template functionshjk2013-10-061-35/+10
| | | | | | | | | This yields the same results as previously and is more in line with existing interfaces. Change-Id: I0bf0372bf18f3bfde579385cddbe594bf71e3c52 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* Use a pimpl in QLoggingCategoryhjk2013-09-271-2/+3
| | | | | | | | With the usual pros/cons. Cleans up the publicly visible interface and gives some headroom for further extensions. Change-Id: I7237b1fd2a22c66574d1b7e532d99137bb56ce1d Reviewed-by: Kai Koehne <kai.koehne@digia.com>
* Add tracing to logging frameworkhjk2013-09-251-2/+72
| | | | | | | | | 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/+138
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>