mirror of
https://github.com/moonlight-stream/moonlight-qt
synced 2024-11-10 05:34:17 +00:00
Output log messages to an attached debugger
This commit is contained in:
parent
ac0e1098b9
commit
ffdf683597
1 changed files with 15 additions and 0 deletions
15
app/main.cpp
15
app/main.cpp
|
@ -25,6 +25,9 @@
|
|||
|
||||
#if defined(Q_OS_WIN32)
|
||||
#include "antihookingprotection.h"
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <Windows.h>
|
||||
#elif defined(Q_OS_LINUX)
|
||||
#include <openssl/ssl.h>
|
||||
#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");
|
||||
|
|
Loading…
Reference in a new issue