Install Qt log handler

This commit is contained in:
Ilya Fedin 2020-07-01 06:24:54 +04:00 committed by John Preston
parent 7ebebc2bc3
commit 2b5df331bd

View File

@ -282,6 +282,19 @@ void Launcher::init() {
prepareSettings();
static QtMessageHandler originalMessageHandler = nullptr;
originalMessageHandler = qInstallMessageHandler([](
QtMsgType type,
const QMessageLogContext &context,
const QString &msg) {
if (originalMessageHandler) {
originalMessageHandler(type, context, msg);
}
if (Logs::DebugEnabled() || !Logs::started()) {
LOG((msg));
}
});
QApplication::setApplicationName(qsl("TelegramDesktop"));
#if defined Q_OS_UNIX && !defined Q_OS_MAC && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)