summaryrefslogtreecommitdiffstats
path: root/src/corelib/global
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@digia.com>2013-01-10 16:15:05 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-20 23:45:06 +0200
commit3efca77e35c0c336961f5e9640382ef87e83e794 (patch)
tree0b57aabfb4b3b4cf793f484fb555a09d91cde457 /src/corelib/global
parent99f9bf9af68530302fcb5a920f477a224adc0e09 (diff)
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 <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/global')
-rw-r--r--src/corelib/global/qlogging.cpp11
1 files changed, 11 insertions, 0 deletions
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 <qt_windows.h>
@@ -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