diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-05-16 11:52:17 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-05-16 11:52:17 +0200 |
commit | ef5bdf968dc947730e4421c8e1c9c1773c0b3db0 (patch) | |
tree | 45a14e80bd10f91054b49ebe798c94f4038da3d2 | |
parent | 83fa63ced28577d8660cbd8224c5627161150685 (diff) | |
download | sink-ef5bdf968dc947730e4421c8e1c9c1773c0b3db0.tar.gz sink-ef5bdf968dc947730e4421c8e1c9c1773c0b3db0.zip |
Print to QDebug on windows
-rw-r--r-- | common/log.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
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, | |||
400 | bool showLocation = debugOutput.isEmpty() ? false : caseInsensitiveContains("location", debugOutput); | 400 | bool showLocation = debugOutput.isEmpty() ? false : caseInsensitiveContains("location", debugOutput); |
401 | bool showFunction = debugOutput.isEmpty() ? false : caseInsensitiveContains("function", debugOutput); | 401 | bool showFunction = debugOutput.isEmpty() ? false : caseInsensitiveContains("function", debugOutput); |
402 | bool showProgram = debugOutput.isEmpty() ? false : caseInsensitiveContains("application", debugOutput); | 402 | bool showProgram = debugOutput.isEmpty() ? false : caseInsensitiveContains("application", debugOutput); |
403 | #ifdef Q_OS_WIN | ||
403 | bool useColor = true; | 404 | bool useColor = true; |
405 | #else | ||
406 | bool useColor = false; | ||
407 | #endif | ||
404 | bool multiline = false; | 408 | bool multiline = false; |
405 | 409 | ||
406 | const QString resetColor = colorCommand(ANSI_Colors::Reset); | 410 | const QString resetColor = colorCommand(ANSI_Colors::Reset); |
@@ -437,10 +441,15 @@ QDebug Sink::Log::debugStream(DebugLevel debugLevel, int line, const char *file, | |||
437 | } | 441 | } |
438 | output += ":"; | 442 | output += ":"; |
439 | 443 | ||
444 | #ifdef Q_OS_WIN | ||
445 | //If we print to std::cout we won't see the messages in DebugView | ||
446 | QDebug debug(QtDebugMsg); | ||
447 | #else | ||
440 | if (sDebugStream.isDestroyed()) { | 448 | if (sDebugStream.isDestroyed()) { |
441 | return QDebug{QtDebugMsg}; | 449 | return QDebug{QtDebugMsg}; |
442 | } | 450 | } |
443 | QDebug debug(sDebugStream); | 451 | QDebug debug(sDebugStream); |
452 | #endif | ||
444 | 453 | ||
445 | debug.noquote().nospace() << output; | 454 | debug.noquote().nospace() << output; |
446 | 455 | ||