From ef5bdf968dc947730e4421c8e1c9c1773c0b3db0 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Wed, 16 May 2018 11:52:17 +0200 Subject: Print to QDebug on windows --- common/log.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/common/log.cpp b/common/log.cpp index 55f6b1f..40d9509 100644 --- a/common/log.cpp +++ b/common/log.cpp @@ -400,7 +400,11 @@ QDebug Sink::Log::debugStream(DebugLevel debugLevel, int line, const char *file, bool showLocation = debugOutput.isEmpty() ? false : caseInsensitiveContains("location", debugOutput); bool showFunction = debugOutput.isEmpty() ? false : caseInsensitiveContains("function", debugOutput); bool showProgram = debugOutput.isEmpty() ? false : caseInsensitiveContains("application", debugOutput); +#ifdef Q_OS_WIN bool useColor = true; +#else + bool useColor = false; +#endif bool multiline = false; const QString resetColor = colorCommand(ANSI_Colors::Reset); @@ -437,10 +441,15 @@ QDebug Sink::Log::debugStream(DebugLevel debugLevel, int line, const char *file, } output += ":"; +#ifdef Q_OS_WIN + //If we print to std::cout we won't see the messages in DebugView + QDebug debug(QtDebugMsg); +#else if (sDebugStream.isDestroyed()) { return QDebug{QtDebugMsg}; } QDebug debug(sDebugStream); +#endif debug.noquote().nospace() << output; -- cgit v1.2.3