Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/desktop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDmytro Korchynskyi <kdl.dima@gmail.com>2021-12-18 17:29:35 +0300
committerDmytro Korchynskyi <kdl.dima@gmail.com>2022-01-12 12:59:34 +0300
commitc8725145711a89a8d63285511ba3c8e2f4ce412f (patch)
treeee9a78af3bd529e8478028159ebcfcb73e049f24 /src
parent66ba89a37df506bf3f76b83db222668e3636bf7b (diff)
write logs to Output window of Visual Studio
Signed-off-by: Dmytro Korchynskyi <kdl.dima@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/libsync/logger.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/libsync/logger.cpp b/src/libsync/logger.cpp
index 2a90c976b..294ad2bb6 100644
--- a/src/libsync/logger.cpp
+++ b/src/libsync/logger.cpp
@@ -89,6 +89,30 @@ bool Logger::isLoggingToFile() const
void Logger::doLog(QtMsgType type, const QMessageLogContext &ctx, const QString &message)
{
const QString msg = qFormatLogMessage(type, ctx, message);
+#if defined(Q_OS_WIN) && 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");
+ OutputDebugString(msgW.c_str());
+ }
+#endif
{
QMutexLocker lock(&_mutex);
_crashLogIndex = (_crashLogIndex + 1) % CrashLogSize;