From 15ddb91bc767b55297cbb35f293f5900379fee18 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Fri, 20 Sep 2013 11:45:54 +0200 Subject: Print non-default categories in default message handler Change the default output of the logging framework to prefix messages with a 'category: ' in case the category is not "default", so that e.g. QLoggingCategory cat("qt.core.codes.windows"); qCWarning(cat) << "MultiByteToWideChar: Cannot convert multibyte text"; will print qt.core.codes.windows: MultiByteToWideChar: Cannot convert multibyte text while output from qWarning etc will show unaltered output. This should help users to discover categories, and to group output together. Change-Id: Iac2e1514f7dc5671966c36a440a119c857564cfc Reviewed-by: Thiago Macieira Reviewed-by: hjk --- tests/auto/corelib/global/qlogging/app/main.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tests/auto/corelib/global/qlogging/app') diff --git a/tests/auto/corelib/global/qlogging/app/main.cpp b/tests/auto/corelib/global/qlogging/app/main.cpp index 14416a914d..621059caad 100644 --- a/tests/auto/corelib/global/qlogging/app/main.cpp +++ b/tests/auto/corelib/global/qlogging/app/main.cpp @@ -40,6 +40,7 @@ ****************************************************************************/ #include +#include struct T { T() { qDebug("static constructor"); } @@ -57,6 +58,9 @@ int main(int argc, char **argv) qWarning("qWarning"); qCritical("qCritical"); + QLoggingCategory cat("category"); + qCWarning(cat) << "qDebug with category"; + qSetMessagePattern(QString()); qDebug("qDebug2"); -- cgit v1.2.3