summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorMorten Sørvig <morten.sorvig@qt.io>2024-03-25 14:24:25 +0100
committerMorten Johan Sørvig <morten.sorvig@qt.io>2024-04-17 10:06:19 +0000
commit7ba4486e7e627eb19b90059e52052693b164d6ad (patch)
treece0b04e7e0f1aaa97a1fef2adf2a10168865187d /src/corelib
parentd570293bb819cee7536081013a7b1e79286665fa (diff)
wasm: log using emscripten_log() by default
Log using emscripten_log by default, unless QT_FORCE_STDERR_LOGGING has been set. It is now possible to log at different levels: qDebug() -> Info qWarning() -> Warning qCritical() -> Error #ifdef out functions which are now no longer in use on Q_OS_WASM Change-Id: I0485e5c070069998a8dfc6759c02bc3b7d6a8a4b Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/global/qlogging.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp
index 9ec936af22..71579ca08a 100644
--- a/src/corelib/global/qlogging.cpp
+++ b/src/corelib/global/qlogging.cpp
@@ -226,6 +226,8 @@ static bool systemHasStderr()
return true;
}
+#ifndef Q_OS_WASM
+
/*!
Returns true if writing to \c stderr will end up in a console/terminal visible to the user.
@@ -310,6 +312,8 @@ bool shouldLogToStderr()
using namespace QtPrivate;
+#endif // ifndef Q_OS_WASM
+
/*!
\class QMessageLogContext
\inmodule QtCore
@@ -1868,8 +1872,9 @@ static bool wasm_default_message_handler(QtMsgType type,
const QMessageLogContext &,
const QString &formattedMessage)
{
- if (shouldLogToStderr())
- return false; // Leave logging up to stderr handler
+ static bool forceStderrLogging = qEnvironmentVariableIntValue("QT_FORCE_STDERR_LOGGING");
+ if (forceStderrLogging)
+ return false;
int emOutputFlags = EM_LOG_CONSOLE;
QByteArray localMsg = formattedMessage.toLocal8Bit();