summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qloggingcategory.h
Commit message (Collapse)AuthorAgeFilesLines
* 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>