From 3efca77e35c0c336961f5e9640382ef87e83e794 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Thu, 10 Jan 2013 16:15:05 +0100 Subject: Import qlogger framework Merge most parts of the qlogger framework from git://gitorious.org/qtplayground/qlogger.git The categorized logging feature is a replacement for qDebug, qWarning and friends. With logging statements in an app/library, a developer can turn on the statements they care about and turn off the ones they don't. Most work for this was done by Wolfgang Beck and Lincoln Ramsay. Task-number: QTBUG-25694 Change-Id: Ib0cdfbbf3694f86ad9ec553b2ea36f09a477cded Reviewed-by: Thiago Macieira --- src/corelib/global/qlogging.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index 5aaa0716f1..1cd11ad667 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -49,6 +49,8 @@ #ifndef QT_BOOTSTRAPPED #include "qcoreapplication.h" #include "qthread.h" +#include "qloggingcategory.h" +#include "private/qloggingregistry_p.h" #endif #ifdef Q_OS_WIN #include @@ -920,6 +922,14 @@ static void qDefaultMsgHandler(QtMsgType type, const char *buf) static void qt_message_print(QtMsgType msgType, const QMessageLogContext &context, const QString &message) { +#ifndef QT_BOOTSTRAPPED + // qDebug, qWarning, ... macros do not check whether category is enabled + if (!context.category || (strcmp(context.category, "default") == 0)) { + if (!QLoggingCategory::defaultCategory().isEnabled(msgType)) + return; + } +#endif + if (!msgHandler) msgHandler = qDefaultMsgHandler; if (!messageHandler) @@ -1151,6 +1161,7 @@ void qSetMessagePattern(const QString &pattern) qMessagePattern()->setPattern(pattern); } + /*! Copies context information from \a logContext into this QMessageLogContext \internal -- cgit v1.2.3