summaryrefslogtreecommitdiffstats
path: root/src/corelib/global/qglobal.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/global/qglobal.cpp')
-rw-r--r--src/corelib/global/qglobal.cpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index 01b3e2ec32..983116f1b3 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -1862,27 +1862,32 @@ extern Q_CORE_EXPORT void qWinMessageHandler(QtMsgType t, const QMessageLogConte
const char *str);
#endif
+// defined in qlogging.cpp
+extern Q_CORE_EXPORT QByteArray qMessageFormatString(QtMsgType type, const QMessageLogContext &context,
+ const char *str);
+
/*!
\internal
*/
-static void qDefaultMsgHandler(QtMsgType, const char *buf)
+static void qDefaultMessageHandler(QtMsgType type, const QMessageLogContext &context, const char *buf)
{
+ QByteArray logMessage = qMessageFormatString(type, context, buf);
#if defined(Q_OS_WINCE)
- QString fstr = QString::fromLatin1(buf);
- fstr += QLatin1Char('\n');
- OutputDebugString(reinterpret_cast<const wchar_t *> (fstr.utf16()));
+ QString fstr = QString::fromLocal8Bit(logMessage);
+ OutputDebugString(reinterpret_cast<const wchar_t *> (fstr.utf16()));
#else
- fprintf(stderr, "%s\n", buf);
- fflush(stderr);
+ fprintf(stderr, "%s", logMessage.constData());
+ fflush(stderr);
#endif
}
/*!
\internal
*/
-static void qDefaultMessageHandler(QtMsgType type, const QMessageLogContext &, const char *buf)
+static void qDefaultMsgHandler(QtMsgType type, const char *buf)
{
- qDefaultMsgHandler(type, buf);
+ QMessageLogContext emptyContext;
+ qDefaultMessageHandler(type, emptyContext, buf);
}
QMessageHandler qInstallMessageHandler(QMessageHandler h)