From 690c5df87cd2bc962ae1f8c50c03f1a56edaf3ca Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Fri, 22 Jan 2021 16:07:31 +0400 Subject: [PATCH] Format dbus errors logging --- .../platform/linux/main_window_linux.cpp | 5 +++- .../linux/notifications_manager_linux.cpp | 25 ++++++++++++------- .../platform/linux/specific_linux.cpp | 9 ++++--- 3 files changed, 26 insertions(+), 13 deletions(-) diff --git a/Telegram/SourceFiles/platform/linux/main_window_linux.cpp b/Telegram/SourceFiles/platform/linux/main_window_linux.cpp index 6192aed097..e99aef7d02 100644 --- a/Telegram/SourceFiles/platform/linux/main_window_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/main_window_linux.cpp @@ -430,7 +430,10 @@ bool IsSNIAvailable() { break; } - LOG(("SNI Error: %1").arg(reply.error().message())); + LOG(("SNI Error: %1: %2") + .arg(reply.error().name()) + .arg(reply.error().message())); + return false; } diff --git a/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp b/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp index 5d47ca8c26..31e3775dcf 100644 --- a/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp @@ -92,8 +92,9 @@ void GetServerInformation(Fn)> callback) { }); }); } else { - LOG(("Native notification error: %1").arg( - reply.error().message())); + LOG(("Native Notification Error: %1: %2") + .arg(reply.error().name()) + .arg(reply.error().message())); crl::on_main([=] { callback(std::nullopt); }); } @@ -120,8 +121,9 @@ void GetCapabilities(Fn callback) { if (reply.isValid()) { crl::on_main([=] { callback(reply.value()); }); } else { - LOG(("Native notification error: %1").arg( - reply.error().message())); + LOG(("Native Notification Error: %1: %2") + .arg(reply.error().name()) + .arg(reply.error().message())); crl::on_main([=] { callback({}); }); } @@ -151,7 +153,9 @@ void GetInhibitionSupported(Fn callback) { const auto error = QDBusPendingReply(*call).error(); if (error.isValid() && error.type() != QDBusError::InvalidArgs) { - LOG(("Native notification error: %1").arg(error.message())); + LOG(("Native Notification Error: %1: %2") + .arg(error.name()) + .arg(error.message())); } crl::on_main([=] { callback(!error.isValid()); }); @@ -186,7 +190,10 @@ bool Inhibited() { return reply.value().toBool(); } - LOG(("Native notification error: %1").arg(reply.error().message())); + LOG(("Native Notification Error: %1: %2") + .arg(reply.error().name()) + .arg(reply.error().message())); + return false; } @@ -220,7 +227,7 @@ QString GetImageKey(const QVersionNumber &specificationVersion) { const auto normalizedVersion = specificationVersion.normalized(); if (normalizedVersion.isNull()) { - LOG(("Native notification error: specification version is null")); + LOG(("Native Notification Error: specification version is null")); return QString(); } @@ -314,7 +321,7 @@ NotificationData::NotificationData( &error); if (error) { - LOG(("Native notification error: %1").arg(error->message)); + LOG(("Native Notification Error: %1").arg(error->message)); g_error_free(error); return; } @@ -528,7 +535,7 @@ void NotificationData::notificationShown( crl::on_main(manager, [=] { manager->clearNotification(my); }); - LOG(("Native notification error: %1").arg(error->message)); + LOG(("Native Notification Error: %1").arg(error->message)); g_error_free(error); } } diff --git a/Telegram/SourceFiles/platform/linux/specific_linux.cpp b/Telegram/SourceFiles/platform/linux/specific_linux.cpp index 83c8cd84f4..3ba1f79946 100644 --- a/Telegram/SourceFiles/platform/linux/specific_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/specific_linux.cpp @@ -104,7 +104,7 @@ QStringList ListDBusActivatableNames() { if (reply.isValid()) { return reply.value(); } else if (reply.error().type() != QDBusError::Disconnected) { - LOG(("App Error: %1: %2") + LOG(("ListActivatableNames Error: %1: %2") .arg(reply.error().name()) .arg(reply.error().message())); } @@ -160,7 +160,9 @@ void PortalAutostart(bool autostart, bool silent = false) { const QDBusError error = QDBusConnection::sessionBus().call(message); if (error.isValid()) { - LOG(("Flatpak autostart error: %1").arg(error.message())); + LOG(("Flatpak Autostart Error: %1: %2") + .arg(error.name()) + .arg(error.message())); } } @@ -218,7 +220,8 @@ uint FileChooserPortalVersion() { return reply.value().toUInt(); } - LOG(("Error getting FileChooser portal version: %1") + LOG(("Error getting FileChooser portal version: %1: %2") + .arg(reply.error().name()) .arg(reply.error().message())); return 0;