aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/qml/qml/v8/qqmlbuiltinfunctions.cpp14
-rw-r--r--tests/auto/qml/debugger/shared/debugutil.cpp3
-rw-r--r--tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp2
-rw-r--r--tests/auto/qml/qqmlconsole/tst_qqmlconsole.cpp6
4 files changed, 17 insertions, 8 deletions
diff --git a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp
index fbc41201fb..8692be6b7b 100644
--- a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp
+++ b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp
@@ -72,6 +72,7 @@
#include <QtCore/qurl.h>
#include <QtCore/qfile.h>
#include <QtCore/qcoreapplication.h>
+#include <QtCore/qloggingcategory.h>
QT_BEGIN_NAMESPACE
@@ -1385,19 +1386,24 @@ static QV4::ReturnedValue writeToConsole(ConsoleLogTypes logType, CallContext *c
result.append(jsStack(v4));
}
+ static QLoggingCategory loggingCategory("qml");
QV4::StackFrame frame = v4->currentStackFrame();
const QByteArray baSource = frame.source.toUtf8();
const QByteArray baFunction = frame.function.toUtf8();
- QMessageLogger logger(baSource.constData(), frame.line, baFunction.constData());
+ QMessageLogger logger(baSource.constData(), frame.line, baFunction.constData(), loggingCategory.categoryName());
+
switch (logType) {
case Log:
- logger.debug("%s", qPrintable(result));
+ if (loggingCategory.isDebugEnabled())
+ logger.debug("%s", result.toUtf8().constData());
break;
case Warn:
- logger.warning("%s", qPrintable(result));
+ if (loggingCategory.isWarningEnabled())
+ logger.warning("%s", result.toUtf8().constData());
break;
case Error:
- logger.critical("%s", qPrintable(result));
+ if (loggingCategory.isCriticalEnabled())
+ logger.critical("%s", result.toUtf8().constData());
break;
default:
break;
diff --git a/tests/auto/qml/debugger/shared/debugutil.cpp b/tests/auto/qml/debugger/shared/debugutil.cpp
index 560c9ca9f3..0bcbf3e9be 100644
--- a/tests/auto/qml/debugger/shared/debugutil.cpp
+++ b/tests/auto/qml/debugger/shared/debugutil.cpp
@@ -235,9 +235,6 @@ void QQmlDebugProcess::processAppOutput()
m_eventLoop.quit();
continue;
}
- } else if (line.startsWith("qml:")) {
- // ### Can't enable quiet mode because that also suppresses application output
- continue; //We don't use these, but they aren't output from the app either
} else {
// set to true if there is output not coming from the debugger
outputFromAppItself = true;
diff --git a/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp b/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp
index e744cde15b..b5b4ed40a2 100644
--- a/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp
+++ b/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp
@@ -117,7 +117,7 @@ void tst_qqmlapplicationengine::application()
QCOMPARE(testProcess->exitCode(), 0);
QByteArray test_stdout = testProcess->readAllStandardOutput();
QByteArray test_stderr = testProcess->readAllStandardError();
- QByteArray test_stderr_target("Start: testData\nEnd\n");
+ QByteArray test_stderr_target("qml: Start: testData\nqml: End\n");
#ifdef Q_OS_WIN
test_stderr_target.replace('\n', QByteArray("\r\n"));
#endif
diff --git a/tests/auto/qml/qqmlconsole/tst_qqmlconsole.cpp b/tests/auto/qml/qqmlconsole/tst_qqmlconsole.cpp
index 43aa82e1e4..42c6578338 100644
--- a/tests/auto/qml/qqmlconsole/tst_qqmlconsole.cpp
+++ b/tests/auto/qml/qqmlconsole/tst_qqmlconsole.cpp
@@ -42,6 +42,7 @@
#include <QDebug>
#include <QQmlEngine>
#include <QQmlComponent>
+#include <QLoggingCategory>
#include "../../shared/util.h"
class tst_qqmlconsole : public QQmlDataTest
@@ -65,6 +66,11 @@ void tst_qqmlconsole::logging()
{
QUrl testUrl = testFileUrl("logging.qml");
+ QLoggingCategory loggingCategory("qml");
+ QVERIFY(loggingCategory.isDebugEnabled());
+ QVERIFY(loggingCategory.isWarningEnabled());
+ QVERIFY(loggingCategory.isCriticalEnabled());
+
QTest::ignoreMessage(QtDebugMsg, "console.debug");
QTest::ignoreMessage(QtDebugMsg, "console.log");
QTest::ignoreMessage(QtDebugMsg, "console.info");