From 026db8039147214570875958dcb4db1218df4fbd Mon Sep 17 00:00:00 2001 From: Tobias Fella Date: Sun, 24 Aug 2025 10:07:59 +0200 Subject: [PATCH] Use logging category for some qDebugs --- src/libneochat/CMakeLists.txt | 7 +++++++ src/libneochat/accountmanager.cpp | 6 ++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/libneochat/CMakeLists.txt b/src/libneochat/CMakeLists.txt index de52563de..bcac0a51a 100644 --- a/src/libneochat/CMakeLists.txt +++ b/src/libneochat/CMakeLists.txt @@ -66,6 +66,13 @@ ecm_add_qml_module(LibNeoChat GENERATE_PLUGIN_SOURCE io.github.quotient_im.libquotient ) +ecm_qt_declare_logging_category(LibNeoChat + HEADER "general_logging.h" + IDENTIFIER "GENERAL" + CATEGORY_NAME "org.kde.neochat" + DEFAULT_SEVERITY Info +) + ecm_qt_declare_logging_category(LibNeoChat HEADER "eventhandler_logging.h" IDENTIFIER "EventHandling" diff --git a/src/libneochat/accountmanager.cpp b/src/libneochat/accountmanager.cpp index 693549472..d72e4c854 100644 --- a/src/libneochat/accountmanager.cpp +++ b/src/libneochat/accountmanager.cpp @@ -12,6 +12,8 @@ #include "neochatroom.h" +#include "general_logging.h" + using namespace Qt::StringLiterals; AccountManager::AccountManager(bool testMode, QObject *parent) @@ -94,7 +96,7 @@ void AccountManager::saveAccessTokenToKeyChain(NeoChatConnection *connection) } const auto userId = connection->userId(); - qDebug() << "Save the access token to the keychain for " << userId; + qCDebug(GENERAL) << "Save the access token to the keychain for " << userId; auto job = new QKeychain::WritePasswordJob(qAppName()); job->setAutoDelete(true); job->setKey(userId); @@ -109,7 +111,7 @@ void AccountManager::saveAccessTokenToKeyChain(NeoChatConnection *connection) QKeychain::ReadPasswordJob *AccountManager::loadAccessTokenFromKeyChain(const QString &userId) { - qDebug() << "Reading access token from the keychain for" << userId; + qCDebug(GENERAL) << "Reading access token from the keychain for" << userId; auto job = new QKeychain::ReadPasswordJob(qAppName(), this); job->setKey(userId);