path: root/src/corelib/doc
diff options
authorKai Koehne <>2014-07-11 12:36:30 +0200
committerKai Koehne <>2014-07-23 15:38:10 +0200
commitea34893b8ff4374fb631da19101ea5ea998eb9dc (patch)
tree40f5ed901a24d6f80639ad47b4b67794c6ab5cb8 /src/corelib/doc
parentc4a2d6ca1ea3e1411391978f089c0b360c833f1b (diff)
Support setting a default severity level for QLoggingCategory
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, "", 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 <>
Diffstat (limited to 'src/corelib/doc')
1 files changed, 3 insertions, 0 deletions
diff --git a/src/corelib/doc/snippets/qloggingcategory/main.cpp b/src/corelib/doc/snippets/qloggingcategory/main.cpp
index efbf9c55d3..3c6424921e 100644
--- a/src/corelib/doc/snippets/qloggingcategory/main.cpp
+++ b/src/corelib/doc/snippets/qloggingcategory/main.cpp
@@ -49,6 +49,9 @@ Q_DECLARE_LOGGING_CATEGORY(driverUsb)
Q_LOGGING_CATEGORY(driverUsb, "driver.usb")
+Q_LOGGING_CATEGORY(driverUsbEvents, "", QtWarningMsg)
// Completely made up example, inspired by :)
struct UsbEntry {