From 52b9a1fcebdd1abecd16be6631992677e860c256 Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 17 Aug 2021 12:25:13 +0300 Subject: [PATCH] Log all Qt messages as usual in debug builds. --- Telegram/SourceFiles/core/launcher.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/core/launcher.cpp b/Telegram/SourceFiles/core/launcher.cpp index 60dd4f130..fa0fae673 100644 --- a/Telegram/SourceFiles/core/launcher.cpp +++ b/Telegram/SourceFiles/core/launcher.cpp @@ -424,13 +424,22 @@ void Launcher::initQtMessageLogging() { QtMsgType type, const QMessageLogContext &context, const QString &msg) { + const auto InvokeOriginal = [&] { +#ifndef _DEBUG + if (Logs::DebugEnabled()) { + return; + } +#endif // _DEBUG + if (OriginalMessageHandler) { + OriginalMessageHandler(type, context, msg); + } + }; + InvokeOriginal(); if (Logs::DebugEnabled() || !Logs::started()) { if (!Logs::WritingEntry()) { // Sometimes Qt logs something inside our own logging. LOG((msg)); } - } else if (OriginalMessageHandler) { - OriginalMessageHandler(type, context, msg); } }); }