From 63c01f14391aef7d7691c7c63a610d47512147ed Mon Sep 17 00:00:00 2001 From: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com> Date: Fri, 23 Feb 2024 17:25:18 -0500 Subject: [PATCH] misc: filter some noisy logs Change-Id: I799e8f66e2008323817c73292f94e8c625564d67 --- src/app/appsettingsmanager.cpp | 4 +++- src/app/connectivitymonitor.cpp | 21 +++++++++++---------- src/app/currentcall.cpp | 3 ++- src/app/mainapplication.cpp | 4 +++- src/app/screensaver.cpp | 7 ++++--- src/app/systemtray.cpp | 9 +++++---- src/app/utils.cpp | 3 ++- 7 files changed, 30 insertions(+), 21 deletions(-) diff --git a/src/app/appsettingsmanager.cpp b/src/app/appsettingsmanager.cpp index a9c2aee18..c7330b3f5 100644 --- a/src/app/appsettingsmanager.cpp +++ b/src/app/appsettingsmanager.cpp @@ -20,6 +20,8 @@ #include "appsettingsmanager.h" +#include "global.h" + #include <QCoreApplication> #include <QLibraryInfo> @@ -101,7 +103,7 @@ AppSettingsManager::loadTranslations() installedTr_.clear(); QString locale_name = getLanguage(); - qDebug() << QString("Using locale: %1").arg(locale_name); + C_INFO << QString("Using locale: %1").arg(locale_name); QString locale_lang = locale_name.split('_')[0]; QTranslator* qtTranslator_lang = new QTranslator(qApp); diff --git a/src/app/connectivitymonitor.cpp b/src/app/connectivitymonitor.cpp index 6f2551bc0..c9024eb73 100644 --- a/src/app/connectivitymonitor.cpp +++ b/src/app/connectivitymonitor.cpp @@ -16,6 +16,8 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#include "global.h" + #ifndef _WIN32 #include <glib.h> #include <gio/gio.h> @@ -171,10 +173,10 @@ static void logConnectionInfo(NMActiveConnection* connection) { if (connection) { - qDebug() << "primary network connection:" << nm_active_connection_get_uuid(connection) - << "default: " << (nm_active_connection_get_default(connection) ? "yes" : "no"); + C_INFO << "primary network connection:" << nm_active_connection_get_uuid(connection) + << "default: " << (nm_active_connection_get_default(connection) ? "yes" : "no"); } else { - qWarning() << "no primary network connection detected, check network settings"; + C_WARN << "no primary network connection detected, check network settings"; } } @@ -191,11 +193,10 @@ nmClientCallback(G_GNUC_UNUSED GObject* source_object, GAsyncResult* result, Con { GError* error = nullptr; if (auto nm_client = nm_client_new_finish(result, &error)) { - qDebug() << "NetworkManager client initialized, version: " - << nm_client_get_version(nm_client) - << ", daemon running:" << (nm_client_get_nm_running(nm_client) ? "yes" : "no") - << ", networking enabled:" - << (nm_client_networking_get_enabled(nm_client) ? "yes" : "no"); + C_INFO << "NetworkManager client initialized, version: " << nm_client_get_version(nm_client) + << ", daemon running:" << (nm_client_get_nm_running(nm_client) ? "yes" : "no") + << ", networking enabled:" + << (nm_client_networking_get_enabled(nm_client) ? "yes" : "no"); auto connection = nm_client_get_primary_connection(nm_client); logConnectionInfo(connection); @@ -205,7 +206,7 @@ nmClientCallback(G_GNUC_UNUSED GObject* source_object, GAsyncResult* result, Con cm); } else { - qWarning() << "error initializing NetworkManager client: " << error->message; + C_WARN << "error initializing NetworkManager client: " << error->message; g_clear_error(&error); } } @@ -222,7 +223,7 @@ ConnectivityMonitor::ConnectivityMonitor(QObject* parent) ConnectivityMonitor::~ConnectivityMonitor() { - qDebug() << "Destroying connectivity monitor"; + C_DBG << "Destroying connectivity monitor"; } bool diff --git a/src/app/currentcall.cpp b/src/app/currentcall.cpp index 4238abc30..0c1bc48c0 100644 --- a/src/app/currentcall.cpp +++ b/src/app/currentcall.cpp @@ -18,6 +18,7 @@ #include "currentcall.h" #include "callparticipantsmodel.h" +#include "global.h" #include <api/callparticipantsmodel.h> #include <api/devicemodel.h> @@ -348,7 +349,7 @@ CurrentCall::onCurrentAccountIdChanged() auto& accInfo = lrcInstance_->getCurrentAccountInfo(); set_isSIP(accInfo.profileInfo.type == profile::Type::SIP); } catch (const std::exception& e) { - qWarning() << "Can't update current call type" << e.what(); + C_DBG << "Can't update current call type" << e.what(); } connectModel(); diff --git a/src/app/mainapplication.cpp b/src/app/mainapplication.cpp index 89d5875ea..cd73bf289 100644 --- a/src/app/mainapplication.cpp +++ b/src/app/mainapplication.cpp @@ -162,6 +162,8 @@ MainApplication::MainApplication(int& argc, char** argv) "libclient.debug=false\n" "qt.*=false\n" "qml.debug=false\n" + "default.debug=false\n" + "client.debug=false\n" "\n"); // These can be set in the environment as well. // e.g. QT_LOGGING_RULES="*.debug=false;qml.debug=true" @@ -449,7 +451,7 @@ MainApplication::initQmlLayer() engine_->load(url); // Report the render interface used. - C_DBG << "Main window loaded using" << getRenderInterfaceString(); + C_INFO << "Main window loaded using" << getRenderInterfaceString(); } void diff --git a/src/app/screensaver.cpp b/src/app/screensaver.cpp index 379dfe1c5..817fb5ec7 100644 --- a/src/app/screensaver.cpp +++ b/src/app/screensaver.cpp @@ -18,6 +18,8 @@ #include "screensaver.h" +#include "global.h" + #include <QDebug> ScreenSaver::ScreenSaver(QObject* parent) @@ -31,8 +33,7 @@ ScreenSaver::ScreenSaver(QObject* parent) } #else : QObject(parent) -{ -} +{} #endif #ifdef Q_OS_LINUX @@ -50,7 +51,7 @@ ScreenSaver::createInterface(void) services_[i], sessionBus_); if (screenSaverInterface_ && screenSaverInterface_->isValid()) { - qDebug() << "Screen saver dbus interface: " << services_[i]; + C_INFO << "Screen saver dbus interface: " << services_[i]; return true; } } diff --git a/src/app/systemtray.cpp b/src/app/systemtray.cpp index 223b10365..bcb8ed947 100644 --- a/src/app/systemtray.cpp +++ b/src/app/systemtray.cpp @@ -19,6 +19,7 @@ #include "systemtray.h" #include "appsettingsmanager.h" +#include "global.h" #ifdef USE_LIBNOTIFY #include <libnotify/notification.h> @@ -106,8 +107,8 @@ SystemTray::SystemTray(AppSettingsManager* settingsManager, QObject* parent) char* spec = nullptr; if (notify_get_server_info(&name, &vendor, &version, &spec)) { - qDebug() << QString("notify server name: %1, vendor: %2, version: %3, spec: %4") - .arg(name, vendor, version, spec); + C_INFO << QString("notify server name: %1, vendor: %2, version: %3, spec: %4") + .arg(name, vendor, version, spec); } // check notify server capabilities @@ -167,7 +168,7 @@ SystemTray::hideNotification(const QString& id) // Close GError* error = nullptr; if (!notify_notification_close(notification->second.nn.get(), &error)) { - qWarning("could not close notification: %s", error->message); + C_WARN << QString("could not close notification: %1").arg(error->message); g_clear_error(&error); return false; } @@ -235,7 +236,7 @@ SystemTray::showNotification(const QString& id, GError* error = nullptr; notify_notification_show(notification.get(), &error); if (error) { - qWarning("failed to show notification: %s", error->message); + C_WARN << QString("failed to show notification: %1").arg(error->message); g_clear_error(&error); } #else diff --git a/src/app/utils.cpp b/src/app/utils.cpp index b8b95afb4..371974f3f 100644 --- a/src/app/utils.cpp +++ b/src/app/utils.cpp @@ -24,6 +24,7 @@ #include "jamiavatartheme.h" #include "lrcinstance.h" +#include "global.h" #include <api/contact.h> @@ -488,7 +489,7 @@ Utils::conversationAvatar(LRCInstance* instance, painter.drawImage(avatar.rect(), peerAAvatar); painter.drawImage(avatar.rect(), peerBAvatar); } catch (const std::exception& e) { - qDebug() << Q_FUNC_INFO << e.what(); + C_DBG << e.what(); } return avatar; } -- GitLab