Logging: Show pattern warning also on Windows GUI apps
Change-Id: Ibbeb606469e7cec5aa68525b05714453151ee066 Reviewed-by: Andreas Holzammer <andreas.holzammer@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
3247f2ece9
commit
390291047e
@ -88,6 +88,11 @@ QT_BEGIN_NAMESPACE
|
|||||||
\sa QMessageLogContext, qDebug(), qWarning(), qCritical(), qFatal()
|
\sa QMessageLogContext, qDebug(), qWarning(), qCritical(), qFatal()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#if defined(Q_OS_WIN) && defined(QT_BUILD_CORE_LIB)
|
||||||
|
// defined in qcoreapplication_win.cpp
|
||||||
|
extern bool usingWinMain;
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !defined(QT_NO_EXCEPTIONS)
|
#if !defined(QT_NO_EXCEPTIONS)
|
||||||
/*!
|
/*!
|
||||||
\internal
|
\internal
|
||||||
@ -509,11 +514,22 @@ void QMessagePattern::setPattern(const QString &pattern)
|
|||||||
else if (lexeme == QLatin1String(threadidTokenC))
|
else if (lexeme == QLatin1String(threadidTokenC))
|
||||||
tokens[i] = threadidTokenC;
|
tokens[i] = threadidTokenC;
|
||||||
else {
|
else {
|
||||||
fprintf(stderr, "%s\n",
|
|
||||||
QString::fromLatin1("QT_MESSAGE_PATTERN: Unknown placeholder %1\n"
|
|
||||||
).arg(lexeme).toLatin1().constData());
|
|
||||||
fflush(stderr);
|
|
||||||
tokens[i] = emptyTokenC;
|
tokens[i] = emptyTokenC;
|
||||||
|
|
||||||
|
QString error = QStringLiteral("QT_MESSAGE_PATTERN: Unknown placeholder %1\n")
|
||||||
|
.arg(lexeme);
|
||||||
|
|
||||||
|
#if defined(Q_OS_WINCE)
|
||||||
|
OutputDebugString(reinterpret_cast<const wchar_t*>(error.utf16()));
|
||||||
|
continue;
|
||||||
|
#elif defined(Q_OS_WIN) && defined(QT_BUILD_CORE_LIB)
|
||||||
|
if (usingWinMain) {
|
||||||
|
OutputDebugString(reinterpret_cast<const wchar_t*>(error.utf16()));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
fprintf(stderr, "%s", error.toLocal8Bit().constData());
|
||||||
|
fflush(stderr);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
char *literal = new char[lexeme.size() + 1];
|
char *literal = new char[lexeme.size() + 1];
|
||||||
@ -717,7 +733,6 @@ void qErrnoWarning(int code, const char *msg, ...)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined(Q_OS_WIN) && defined(QT_BUILD_CORE_LIB)
|
#if defined(Q_OS_WIN) && defined(QT_BUILD_CORE_LIB)
|
||||||
extern bool usingWinMain;
|
|
||||||
extern Q_CORE_EXPORT void qWinMsgHandler(QtMsgType t, const char *str);
|
extern Q_CORE_EXPORT void qWinMsgHandler(QtMsgType t, const char *str);
|
||||||
extern Q_CORE_EXPORT void qWinMessageHandler(QtMsgType t, const QMessageLogContext &context,
|
extern Q_CORE_EXPORT void qWinMessageHandler(QtMsgType t, const QMessageLogContext &context,
|
||||||
const QString &str);
|
const QString &str);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user