From 67d5f79fe6f86726eff0461bd6f3bb928801723c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 8 Feb 2018 12:51:27 +0100 Subject: logging: Clarify and document how we look for the presence of a console The privately exported qt_logging_to_console() function has been renamed to shouldLogToStderr, and exported in the QtPrivate namespace for QtTestLib. [ChangeLog][Important behavior changes][Logging (including qDebug and qWarning)] The QT_LOGGING_TO_CONSOLE environment variable has been deprecated. Use the more specific QT_ASSUME_STDERR_HAS_CONSOLE or QT_FORCE_STDERR_LOGGING, depending on your usecase. Change-Id: Ie29228eeac3b700c3de94fee022d5d66d9b5c210 Reviewed-by: Simon Hausmann --- src/testlib/qplaintestlogger.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/testlib') diff --git a/src/testlib/qplaintestlogger.cpp b/src/testlib/qplaintestlogger.cpp index a6797012c7..e5226b7820 100644 --- a/src/testlib/qplaintestlogger.cpp +++ b/src/testlib/qplaintestlogger.cpp @@ -44,6 +44,8 @@ #include #include +#include + #include #include #include @@ -205,15 +207,11 @@ namespace QTest { } } -#if defined(Q_OS_WIN) -Q_CORE_EXPORT bool qt_logging_to_console(); // defined in qlogging.cpp -#endif - void QPlainTestLogger::outputMessage(const char *str) { #if defined(Q_OS_WIN) - // log to system log only if output is not redirected, and no console is attached - if (!qt_logging_to_console() && stream == stdout) { + // Log to system log only if output is not redirected and stderr not preferred + if (stream == stdout && !QtPrivate::shouldLogToStderr()) { OutputDebugStringA(str); return; } -- cgit v1.2.3