diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2018-02-08 12:51:27 +0100 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2018-03-07 18:12:09 +0000 |
commit | 67d5f79fe6f86726eff0461bd6f3bb928801723c (patch) | |
tree | a6cfb5061a272ca6226962fb80ddfd35a4780b2f /src/testlib | |
parent | 3d53cf976dc41d136c0508ec05fa757fcf27f71b (diff) |
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 <simon.hausmann@qt.io>
Diffstat (limited to 'src/testlib')
-rw-r--r-- | src/testlib/qplaintestlogger.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
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 <QtTest/private/qbenchmark_p.h> #include <QtTest/private/qbenchmarkmetric_p.h> +#include <QtCore/private/qlogging_p.h> + #include <stdarg.h> #include <stdio.h> #include <stdlib.h> @@ -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; } |