From ee85cdee67d164315e52a05462b03fe7091cc26d Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Wed, 23 Apr 2014 10:32:07 +0200 Subject: 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 --- src/corelib/io/qloggingcategory.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/corelib/io') 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 -- cgit v1.2.3