diff options
author | Tarja Sundqvist <tarja.sundqvist@qt.io> | 2023-06-09 17:30:54 +0300 |
---|---|---|
committer | Tarja Sundqvist <tarja.sundqvist@qt.io> | 2023-06-09 17:30:54 +0300 |
commit | da6e958319e95fe564d3b30c931492dd666bfaff (patch) | |
tree | 16ac1556a573daeba5c9c4b795f86aa166ffe467 /src/corelib/io/qloggingcategory.cpp | |
parent | 29400a683f96867133b28299c0d0bd6bcf40df35 (diff) | |
parent | a96fc76fa78f3500266b3a34016f9e1bd29b319c (diff) |
Merge remote-tracking branch 'origin/tqtc/lts-5.15.11' into tqtc/lts-5.15-opensourcev5.15.11-lts-lgpl
Change-Id: Iac056a5e9f59fc8d1929171c18039aeb45be22b8
Diffstat (limited to 'src/corelib/io/qloggingcategory.cpp')
-rw-r--r-- | src/corelib/io/qloggingcategory.cpp | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/src/corelib/io/qloggingcategory.cpp b/src/corelib/io/qloggingcategory.cpp index 5de8be116c..8939204501 100644 --- a/src/corelib/io/qloggingcategory.cpp +++ b/src/corelib/io/qloggingcategory.cpp @@ -387,13 +387,27 @@ QLoggingCategory *QLoggingCategory::defaultCategory() */ /*! - Installs a function \a filter that is used to determine which categories - and message types should be enabled. Returns a pointer to the previous - installed filter. - - Every QLoggingCategory object created is passed to the filter, and the - filter is free to change the respective category configuration with - \l setEnabled(). + \brief Take control of how logging categories are configured. + + Installs a function \a filter that is used to determine which categories and + message types should be enabled. If \a filter is \nullptr, the default + message filter is reinstated. Returns a pointer to the previously-installed + filter. + + Every QLoggingCategory object that already exists is passed to the filter + before \c installFilter() returns, and the filter is free to change each + category's configuration with \l setEnabled(). Any category it doesn't + change will retain the configuration it was given by the prior filter, so + the new filter does not need to delegate to the prior filter during this + initial pass over existing categories. + + Any new categories added later will be passed to the new filter; a filter + that only aims to tweak the configuration of a select few categories, rather + than completely overriding the logging policy, can first pass the new + category to the prior filter, to give it its standard configuration, and + then tweak that as desired, if it is one of the categories of specific + interest to the filter. The code that installs the new filter can record the + return from \c installFilter() for the filter to use in such later calls. When you define your filter, note that it can be called from different threads; but never concurrently. This filter cannot call any static functions from QLoggingCategory. @@ -401,6 +415,10 @@ QLoggingCategory *QLoggingCategory::defaultCategory() Example: \snippet qloggingcategory/main.cpp 21 + installed (in \c{main()}, for example) by + + \snippet qloggingcategory/main.cpp 22 + Alternatively, you can configure the default filter via \l setFilterRules(). */ QLoggingCategory::CategoryFilter |