summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qloggingcategory.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix logging file location docsFrederik Gladhorn2014-06-251-2/+2
| | | | | | | The location mentioned in the docs didn't work because it was wrong. Change-Id: I80bbc16bfecc5662317f9963299981266b95bba8 Reviewed-by: Kai Koehne <kai.koehne@digia.com>
* Fix data race on QLoggingCategory when using qDebug from multiple threadsDavid Faure2014-06-201-10/+26
| | | | | | | setEnabled() would race with isEnabled()/isDebugEnabled()/etc. Change-Id: I2004cba81d5417a634b97f5c2f98d3a4ab71770d Reviewed-by: David Faure <david.faure@kdab.com>
* Logging: Mention 'best practices' for using QLoggingCategoryKai Koehne2014-04-291-0/+6
| | | | | | | | | | | | | | | QLoggingCategory objects are meant to be mere 'handles' for the registry. It's therefore not recommended to - manipulate them directly (via setEnabled()), except in a filter - export them across module boundaries - subclass them Subclassing QLoggingCategory also breaks compilations in a certain circumstances (no variadic macros). Task-number: QTBUG-37283 Change-Id: Ib12fb43d955902c7fa4583296d64afc5eca01200 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Logging: Let user configure rules via QT_LOGGING_RULESKai Koehne2014-03-131-6/+8
| | | | | | | | | | | | 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/+3
| | | | | | | | | | | | | | 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>
* Logging: Change 'rules' section name to 'Rules'Kai Koehne2014-02-261-1/+1
| | | | | | | | | 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>
* Add const overload for QLoggingCategory::operator()()Kai Koehne2014-02-151-0/+8
| | | | | | | | | | | | | | | | | | | | 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>
* Allow configuration of logging rules from file systemKai Koehne2014-02-111-16/+57
| | | | | | | | | | | | | | | | | | | | 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>
* Merge "Merge remote-tracking branch 'origin/stable' into dev" into ↵Frederik Gladhorn2014-02-111-1/+1
|\ | | | | | | refs/staging/dev
| * Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2014-02-071-1/+1
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/gui/kernel/qguiapplication.cpp src/plugins/platforms/android/androidjnimain.cpp src/plugins/platforms/android/qandroidplatformintegration.cpp src/plugins/platforms/android/qandroidplatformintegration.h src/plugins/platforms/android/qandroidplatformopenglcontext.cpp src/plugins/platforms/cocoa/qcocoawindow.h src/plugins/platforms/cocoa/qcocoawindow.mm src/plugins/platforms/xcb/qxcbconnection_xi2.cpp src/sql/doc/src/sql-driver.qdoc src/widgets/widgets/qtoolbararealayout.cpp Change-Id: Ifd7e58760c3cb6bd8a7d1dd32ef83b7ec190d41e
| | * Doc: Fix broken linksSze Howe Koh2014-02-041-1/+1
| | | | | | | | | | | | | | | Change-Id: Ic275dfbf0b332fc34ea0fac1c31c4935ad961527 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
* | | Print qCDebugs in arbitrary categories by defaultGiorgos Tsiapaliokas2014-02-101-8/+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>
* / Allow printf style for qCDebug, qCWarning, qCCritical macrosKai Koehne2014-01-211-0/+56
|/ | | | | | | | | | | | | | | | | 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>
* Prevent clang from warning about unused variablesKai Koehne2013-11-081-0/+3
| | | | | | | | Fixes a compiler warning introduced by 79b975756a100cc46182 Change-Id: Ie9bc677d061f0bb0530eae88715069042b2ab440 Reviewed-by: hjk <hjk121@nokiamail.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
* Revert "Add tracing to logging framework"Kai Koehne2013-11-071-314/+6
| | | | | | | | | | | | | | | | | | | 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>
* Reserve some space for future use in QLoggingCategoryKai Koehne2013-10-241-1/+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>
* Link from QLoggingCategory documentation to QTracer/QTraceGuardKai Koehne2013-10-181-5/+6
| | | | | | Change-Id: I331966f6137a31f089425a639afe8f9f4088c0b6 Reviewed-by: Jerome Pasion <jerome.pasion@digia.com> Reviewed-by: hjk <hjk121@nokiamail.com>
* Give an example how to configure categorized loggingKai Koehne2013-10-161-21/+35
| | | | | | Change-Id: I178bb6e75fba246932b318c2c0c5afd243575a92 Reviewed-by: Jerome Pasion <jerome.pasion@digia.com> Reviewed-by: hjk <hjk121@nokiamail.com>
* Let QLoggingCategory::defaultCategory return a pointerhjk2013-10-111-4/+11
| | | | | | | | The pointer can be null. Going trough the reference invokes undefined behavior here. Change-Id: Ia84e4e732cdcbbaee0f5f0679765d18069ea8b2d Reviewed-by: Kai Koehne <kai.koehne@digia.com>
* Remove default label for QtMsgTypeKai Koehne2013-10-071-3/+1
| | | | | | | | Adding another category will most likely require a dedicated handling anyway, so better let the compiler warn about it. Change-Id: I323ca1250d82e33c086f1930e1df0a6337d6f16f Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
* Improve QLoggingCategory documentationKai Koehne2013-10-071-42/+21
| | | | | Change-Id: I142e954cc3622643d80b8efd3b1d659c11d4e239 Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* Replace QLoggingCategory::isEnabled by non-template functionshjk2013-10-061-23/+68
| | | | | | | | | 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-7/+23
| | | | | | | | 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-3/+290
| | | | | | | | | 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/+352
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>