improve debugger logs on Windows to have same content than normal log
authorMatthieu Gallien <matthieu.gallien@nextcloud.com>
Wed, 2 Oct 2024 13:21:09 +0000 (15:21 +0200)
committerMatthieu Gallien <matthieu.gallien@nextcloud.com>
Fri, 4 Oct 2024 10:02:39 +0000 (12:02 +0200)
makes debugger logs more usefull

Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
src/libsync/logger.cpp

index 66c853559287b031192df70963c7670c92bed10a..5e84be48ac0d7de09d6c4811adf036bf2735bfe1 100644 (file)
@@ -123,24 +123,7 @@ void Logger::doLog(QtMsgType type, const QMessageLogContext &ctx, const QString
 #if defined Q_OS_WIN && ((defined NEXTCLOUD_DEV && NEXTCLOUD_DEV) || defined QT_DEBUG)
     // write logs to Output window of Visual Studio
     {
-        QString prefix;
-        switch (type) {
-        case QtDebugMsg:
-            break;
-        case QtInfoMsg:
-            break;
-        case QtWarningMsg:
-            prefix = QStringLiteral("[WARNING] ");
-            break;
-        case QtCriticalMsg:
-            prefix = QStringLiteral("[CRITICAL ERROR] ");
-            break;
-        case QtFatalMsg:
-            prefix = QStringLiteral("[FATAL ERROR] ");
-            break;
-        }
-        auto msgW = QString(prefix + message).toStdWString();
-        msgW.append(L"\n");
+        const auto msgW = QStringLiteral("%1\n").arg(msg).toStdWString();
         OutputDebugString(msgW.c_str());
     }
 #endif