diff options
author | Kai Koehne <kai.koehne@digia.com> | 2014-04-23 10:32:07 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-04-29 16:26:25 +0200 |
commit | ee85cdee67d164315e52a05462b03fe7091cc26d (patch) | |
tree | 0aed51072ce1685734764c2937bd7b7eaf86b67b | |
parent | 27ea8fa99f84d96618d75a8245364457585bc5e2 (diff) |
Logging: Mention 'best practices' for using QLoggingCategory
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>
-rw-r--r-- | src/corelib/io/qloggingcategory.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/corelib/io/qloggingcategory.cpp b/src/corelib/io/qloggingcategory.cpp index 08ecd67dc8..518052e537 100644 --- a/src/corelib/io/qloggingcategory.cpp +++ b/src/corelib/io/qloggingcategory.cpp @@ -62,6 +62,12 @@ Q_GLOBAL_STATIC_WITH_ARGS(QLoggingCategory, qtDefaultCategory, by a string - at runtime. Whether a category should be actually logged or not can be checked with the \l isEnabled() methods. + All objects are meant to be configured by a common registry (see also + \l{Configuring Categories}). Different objects can also represent the same + category. It's therefore not recommended to export objects across module + boundaries, nor to manipulate the objects directly, nor to inherit from + QLoggingCategory. + \section1 Creating category objects The Q_LOGGING_CATEGORY() and the Q_DECLARE_LOGGING_CATEGORY() macros |