summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qloggingcategory.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Doc: Fix snippet for Q_DECLARE_EXPORTED_CATEGORYKai Köhne2023-01-021-1/+1
| | | | | | | | The name argument must be a C++ variable name, not a string. Pick-to: 6.5 Change-Id: I6bc45bc9a57fd8429cf033aa118eebff0fcfc4a5 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Doc: Add documentation for qCFatal()Kai Köhne2022-12-051-4/+45
| | | | | Change-Id: Iad9ea51285300eb06fdd7e68dd747702cb0a80e5 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Doc: Remove mentioning of variadic macrosKai Köhne2022-08-241-2/+1
| | | | | | | | | We don't support compilers without variadic macros anymore; the check in code was removed already in commit 4628e5cded8. Pick-to: 6.4 Change-Id: Ica4d0b2f7055e3d00ae780e23eb4e5a9d2dcc191 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Remove uses of Q_ATOMIC_INT{8,16,32}_IS_SUPPORTEDMarc Mutz2022-07-061-19/+0
| | | | | | | | | | | It's always true these days, assert so in qatomic.cpp and tst_QAtomicInteger. Update the docs. Pick-to: 6.4 Change-Id: I3684cff96c1d2e05677314e29514cc279bd6b1a1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add a way to declare _exported_ logging categoriesGiuseppe D'Angelo2022-06-271-2/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a library declares a logging category that needs to be used by clients (e.g. via inline methods, macros, etc.), then the logging category function generated by Q_DECLARE_LOGGING_CATEGORY has to be exported. We've seen this problem with Q_NAMESPACE, Q_GADGET, etc.: these macros also declare functions or objects that in some cases need to be exported. And precisely like Q_NAMESPACE, Q_GADGET, etc., people end up relying on the implementation details of Q_DECLARE_LOGGING_CATEGORY (specifically, what does it expand to) in order to place the export directives in the right place. Introduce a more robust solution and apply it around qtbase. Cleanup some minor code as a drive-by (remove `extern` and useless semicolons). [ChangeLog][QtCore][QLoggingCategory] Added the Q_DECLARE_EXPORTED_LOGGING_CATEGORY macro, in order to allow dynamic libraries to declare a logging category that can be then used by client code. Change-Id: I18f40cc937cfe8277b8d62ebc824c27a0773de04 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Fix doc and example of QLoggingCategory::installCategory()Edward Welbourne2022-06-131-7/+25
| | | | | | | | | | | | | | | | | | | | | Snippet [22] was unused and the example using snippet [21] neglected to show how its oldCategoryFilter got initialized, which is what [22] does. But it turns out the example code was crashy in any case, as it left the oldCategoryFilter uninitialized (albeit probably null) until the call to installFilter() had returned, and installFilter() calls the new filter, so the new filter needs to check oldCategoryFilter before calling it. The doc also failed to explain why it's OK to not defer to the prior filter in these calls during installFilter(), so revise the doc and example so that the latter behaves sensibly and readers of the former are likely to use the function safely. This amends commit 8f0654ceb878b6c8a08c7f5b790027c26e007c13 which added the snippets and the use of one of them, but not the other. Fixes: QTBUG-49704 Pick-to: 6.4 6.3 6.2 5.15 Change-Id: Iddb8d97b0bef417d8f16e7910730cfa59ea3e715 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-161-38/+2
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Exploit the new macro varargs form of Q_GLOBAL_STATICEdward Welbourne2022-04-221-4/+2
| | | | | | | | Convert various uses of Q_GLOBAL_STATIC_WITH_ARGS() to the less verbose form the recent reworking makes possible. Change-Id: I57820660b5d00d39bf54b5a08cb921ebaec57c7c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Clarify that QLoggingCategory works independent of compiler build typeKai Köhne2021-05-271-1/+8
| | | | | | | | | Also mention exception for internal categories starting with 'qt.' Fixes: QTBUG-93852 Change-Id: Iff8657a31074ee70cba25f6acdccb5ba4b1d3b01 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Unify QLoggingCategory's two constructorsEdward Welbourne2020-07-271-17/+4
| | | | | | | | | This follows upon commit ca0df4b2694fc3ca0c31cda0d5edec7e76f7dfcb's comment requesting the unification. Tidied docs at the same time. Task-number: QTBUG-85700 Change-Id: Ia12dbe98b94388030c7a06036c5287cfbcc4fd05 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Merge remote-tracking branch 'origin/5.13' into 5.14Liang Qi2019-11-131-1/+1
|\ | | | | | | | | | | | | | | Conflicts: examples/widgets/widgets/scribble/mainwindow.cpp This amends cb54c16584cf3be746a1a536c1e37cb3022a2f1b. Change-Id: Iaae60a893330524b2973917e23b31f9d51f8bd38
| * Fix typo in QLoggingCategory documentationMitch Curtis2019-11-061-1/+1
| | | | | | | | | | Change-Id: Id147e6f4c25a75eed5456390819f340d8d20172c Reviewed-by: Jesus Fernandez <jsfdez@gmail.com>
* | Merge remote-tracking branch 'origin/5.13' into 5.14Liang Qi2019-09-041-140/+127
|\| | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/codecs/qicucodec.cpp src/dbus/qdbusserver.cpp src/gui/painting/qbezier.cpp src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp src/plugins/printsupport/cups/qppdprintdevice.cpp Change-Id: I2703128bb64baf5580fbc2c2061b55b0f0611d2a
| * Docs: Some cleanup of class documentationKavindra Palaraja2019-08-271-140/+127
| | | | | | | | | | Change-Id: I62f89157e57189a97151f9661bc354af9bd67468 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* | Port from QAtomic::load() to loadRelaxed()Giuseppe D'Angelo2019-06-201-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Semi-automated, just needed ~20 manual fixes: $ find \( -iname \*.cpp -or -iname \*.h \) -exec perl -pe 's/(\.|->)load\(\)/$1loadRelaxed\(\)/g' -i \{\} + $ find \( -iname \*.cpp -or -iname \*.h \) -exec perl -pe 's/(\.|->)store\(/$1storeRelaxed\(/g' -i \{\} + It can be easily improved (e.g. for store check that there are no commas after the opening parens). The most common offender is QLibrary::load, and some code using std::atomic directly. Change-Id: I07c38a3c8ed32c924ef4999e85c7e45cf48f0f6c Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | Move away from using 0 as a pointer constantAllan Sandfeld Jensen2019-06-071-4/+4
|/ | | | | | | | | Cleans up most of corelib to use nullptr or default enums where appropriate. Change-Id: Ifcaac14ecdaaee730f87f10941db3ce407d71ef9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Doc: Move literal code block to a separate fileCristian Maureira-Fredes2018-10-151-15/+4
| | | | | | | | | | | We need to override this snippet for the documentation we generate for Qt for Python, and it is easier to have it on a separate file. Task-number: PYSIDE-801 Task-number: PYSIDE-691 Change-Id: Ideb5b6af25024279f167137d3b65660bb9c96a7e Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Doc: Remove duplicate thread-safe documentation from logging macrosKai Koehne2018-08-201-16/+0
| | | | | | | | qdoc now handles \threadsafe also for macros, so we can remove the explicit \note. Change-Id: Iabeb7f69d237e7024a4f584adc516951b06d752b Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* Ownership is unclear, so document it to avoid crashes for usersSune Vuorela2018-07-021-0/+4
| | | | | | Change-Id: I708b04fcdf4f118526317f3aea2401f5dafd2e87 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Doc: Show more examples on how to have multiple logging rulesKai Koehne2018-04-251-11/+16
| | | | | | | Task-number: QTBUG-66050 Change-Id: I6872cd64f9b27b9849e4166af7aa6414c372cd5e Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: hjk <hjk@qt.io>
* Doc: State that qDebug and friends are thread-safeKai Koehne2017-10-171-0/+8
| | | | | | | | | | There's a common misconception that qDebug and friends are not thread-safe, so let's explicitly state this. Change-Id: I48d4ab8983017a9f2e7c9932a49ed573baa22929 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Doc: QLoggingCategory::setEnabled() should only be called in filterKai Koehne2017-07-181-6/+5
| | | | | Change-Id: Ib159c45ca259af125e48e3dfe59d64abc5f81f81 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Doc: Clarify limitations of category filterKai Koehne2017-07-181-2/+2
| | | | | | | As suggested by ogoffart. Change-Id: I15747869147819799b14dfe0670ff2225f76fc03 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Document that QLoggingCategory is thread-safeKai Koehne2017-06-081-2/+24
| | | | | | Task-number: QTBUG-60475 Change-Id: Idced5e1a8ad1d2d28839fd23126a7bf084141eca Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-08-131-1/+1
|\ | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/global/qglobal.cpp src/corelib/io/qsettings.cpp src/corelib/itemmodels/qstringlistmodel.cpp tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp Change-Id: I1c6c306ef42c3c0234b19907914b19da706b4a03
| * Doc: Change instances of '(Mac) OS X' to 'macOS'Topi Reinio2016-08-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As of version 10.12 (Sierra), the name of Apple's desktop operating system will be macOS. Change the occurrences where the Mac platform is discussed to use a macro \macos, which expands to 'macOS'. This helps with adapting to future renaming. Update the instructions on mac-specific Q_OS_* macro usage. Add a \target for the old 'Qt for OS X' topic to keep links working for other documentation modules that try to link with the old name. Change-Id: Id33fb0cd985df702a4ae4efb4c5fd428e77d9b85 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-06-291-0/+9
|\| | | | | | | Change-Id: If6ba05867e7c98159e1b94ff71923e8b36bdbccb
| * Document limitations and good practice for logging category namesKai Koehne2016-06-231-0/+9
| | | | | | | | | | | | | | Task-number: QTBUG-54238 Change-Id: I2b6f54fb26d24e6da19c0e09782483eeb10206e1 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Michael Brasser <michael.brasser@live.com>
* | 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>
* QLoggingRegistry: Look up logging configuration in Qt data pathKai Koehne2015-08-241-0/+1
| | | | | | | | | | | | | | | | Distributions like Fedora would like to disable logging globally, without having to patch Qt. Fedora right now therefore adds a /etc/xdg/qtlogging.ini file, which unfortunately though also messes with Qt versions compiled by the user. This patch lets QLoggingRegistry look up logging configurations also in QLibraryInfo::DataPath, which would allow to tweak the values per Qt installation. See also https://bugzilla.redhat.com/show_bug.cgi?id=1227295 Change-Id: I0fca304a47f45739d0c08a9e4e715673bf10aa80 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* QT_LOGGING_RULES supports multiple rules separated by semicolonsTasuku Suzuki2015-07-161-0/+8
| | | | | | | | | [ChangeLog][QtCore][Logging] QT_LOGGING_RULES now supports multiple rules separated by semicolons Change-Id: I7fdd62a3d719aeb16cad54f193befb6c203bc160 Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com> Reviewed-by: Martin Smith <martin.smith@digia.com>
* Merge remote-tracking branch 'origin/5.4' into 5.5Liang Qi2015-04-151-1/+1
|\ | | | | | | Change-Id: I004854a25ebbf12b1fda88900162fe7878716c58
| * Doc: Fix using Apple-related terminology in Qt CoreAlexander Volkov2015-03-311-1/+1
| | | | | | | | | | | | | | | | | | | | | | Use the name "OS X" instead of "Mac OS X", "Mac OS" and "OSX", and mention iOS. Replace "Carbon Preferences API" by "CFPreferences API" in the QSettings documentation. Change-Id: Ia7f9fb874276c7c445a1649df521b96ff43daa0c Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Venugopal Shivashankar <venugopal.shivashankar@digia.com> Reviewed-by: Topi Reiniö <topi.reinio@digia.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>
* | Add QtInfoMsgKai Koehne2015-01-091-8/+67
|/ | | | | | | | | | | | | | 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>
* Doc: corrected autolink errors corelib/ioNico Vertriest2014-11-261-4/+4
| | | | | | | Task-number: QTBUG-40362 Change-Id: I1cdbde1f6b003556ba4b5e97a49c6d918518da0d Reviewed-by: Venugopal Shivashankar <venugopal.shivashankar@digia.com> Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* Improve QLoggingCategory's detailed description.Mitch Curtis2014-10-221-10/+13
| | | | | Change-Id: I40527890fb752c3a1c0f8d8a8fa4ca2b19e4fc08 Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
* Doc: Use title case in section1 titlesNico Vertriest2014-09-301-4/+4
| | | | | | | | Using Python script title-cased.py Task-number: QTBUG-41250 Change-Id: I00d3d7a0b30db7304a7904efd6d63abd9a7b493b Reviewed-by: Topi Reiniö <topi.reinio@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>
* Remove normalization of "default" categoryKai Koehne2014-07-301-9/+3
| | | | | | | | | | | | 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-10/+54
| | | | | | | | | | | | | | | | | | | | | | | | | 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/+1
| | | | | | | | | | | | | | | | 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>
* Add example qtlogging.conf file to QLoggingCategory documentationKai Koehne2014-07-211-1/+7
| | | | | | Change-Id: I0ceeb8afa711cc7bc1378287b0d550871e5bfd9d Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: hjk <hjk121@nokiamail.com>
* QLoggingCategory documentation improvementsKai Koehne2014-07-141-1/+3
| | | | | Change-Id: I9cc16d01f62d94fa3e7869bf9bb7734c774f82e3 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
* 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>