diff --git a/app/main.cpp b/app/main.cpp index a71e512f..7f153b16 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -25,6 +25,9 @@ #if defined(Q_OS_WIN32) #include "antihookingprotection.h" + +#define WIN32_LEAN_AND_MEAN +#include #elif defined(Q_OS_LINUX) #include #endif @@ -75,6 +78,18 @@ void logToLoggerStream(QString& message) { QMutexLocker lock(&s_LoggerLock); +#if defined(QT_DEBUG) && defined(Q_OS_WIN32) + // Output log messages to a debugger if attached + if (IsDebuggerPresent()) { + static QString lineBuffer; + lineBuffer += message; + if (message.endsWith('\n')) { + OutputDebugStringW(lineBuffer.toStdWString().c_str()); + lineBuffer.clear(); + } + } +#endif + // Strip session encryption keys and IVs from the logs message.replace(k_RikeyRegex, "&rikey=REDACTED"); message.replace(k_RikeyIdRegex, "&rikeyid=REDACTED");