[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [ktp-common-internals/mklapetek/SpaceBar] KTp: [message-processor] Introduce separate logging catego
From:       Martin Klapetek <mklapetek () kde ! org>
Date:       2016-03-17 22:25:50
Message-ID: E1aggMY-0005mw-Fp () scm ! kde ! org
[Download RAW message or body]

Git commit deb26544e4e45e5d0fc8ba9d1cca2f0991fe349c by Martin Klapetek.
Committed on 17/03/2016 at 22:25.
Pushed by mklapetek into branch 'mklapetek/SpaceBar'.

[message-processor] Introduce separate logging category

It's way too verbose and this allows to turn this one off (it's still
useful for debugging)

M  +10   -10   KTp/message-processor.cpp
M  +3    -0    KTp/message-processor.h

http://commits.kde.org/telepathy-common-internals/deb26544e4e45e5d0fc8ba9d1cca2f0991fe349c


diff --git a/KTp/message-processor.cpp b/KTp/message-processor.cpp
index a7ff829..df1896d 100644
--- a/KTp/message-processor.cpp
+++ b/KTp/message-processor.cpp
@@ -30,6 +30,8 @@
 #include <KServiceTypeTrader>
 #include <KPluginFactory>
 
+Q_LOGGING_CATEGORY(KTP_MESSAGEPROCESSOR, "ktp-message-processor")
+
 using namespace KTp;
 
 FilterPlugin::FilterPlugin(const KPluginInfo &pluginInfo, KTp::AbstractMessageFilter \
*instance_): @@ -68,15 +70,15 @@ void MessageProcessor::Private::loadFilter(const \
KPluginInfo &pluginInfo)  
     KPluginFactory *factory = KPluginLoader(service->library()).factory();
     if (factory) {
-        qCDebug(KTP_COMMONINTERNALS) << "loaded factory :" << factory;
+        qCDebug(KTP_MESSAGEPROCESSOR) << "loaded factory :" << factory;
         AbstractMessageFilter *filter = factory->create<AbstractMessageFilter>(q);
 
         if (filter) {
-            qCDebug(KTP_COMMONINTERNALS) << "loaded message filter : " << filter;
+            qCDebug(KTP_MESSAGEPROCESSOR) << "loaded message filter : " << filter;
             filters << FilterPlugin(pluginInfo, filter);
         }
     } else {
-        qCWarning(KTP_COMMONINTERNALS) << "error loading plugin :" << \
service->library(); +        qCWarning(KTP_MESSAGEPROCESSOR) << "error loading plugin \
:" << service->library();  }
 
     // Re-sort filters by weight
@@ -90,7 +92,7 @@ void MessageProcessor::Private::unloadFilter(const KPluginInfo \
&pluginInfo)  const FilterPlugin &plugin = *iter;
 
         if (plugin.name == pluginInfo.pluginName()) {
-            qCDebug(KTP_COMMONINTERNALS) << "unloading message filter : " << \
plugin.instance; +            qCDebug(KTP_MESSAGEPROCESSOR) << "unloading message \
filter : " << plugin.instance;  plugin.instance->deleteLater();
             filters.erase(iter);
             return;
@@ -100,7 +102,7 @@ void MessageProcessor::Private::unloadFilter(const KPluginInfo \
&pluginInfo)  
 void MessageProcessor::Private::loadFilters()
 {
-    qCDebug(KTP_COMMONINTERNALS) << "Starting loading filters...";
+    qCDebug(KTP_MESSAGEPROCESSOR) << "Starting loading filters...";
 
     KPluginInfo::List plugins = \
MessageFilterConfigManager::self()->enabledPlugins();  
@@ -111,8 +113,6 @@ void MessageProcessor::Private::loadFilters()
 
 KTp::MessageProcessor* MessageProcessor::instance()
 {
-    qCDebug(KTP_COMMONINTERNALS);
-
     static KTp::MessageProcessor *mp_instance;
     static QMutex mutex;
     mutex.lock();
@@ -174,7 +174,7 @@ QString MessageProcessor::header()
                   % QLatin1String("\" />\n");
     }
 
-    qCDebug(KTP_COMMONINTERNALS) << out;
+    qCDebug(KTP_MESSAGEPROCESSOR) << out;
 
     return out;
 }
@@ -194,7 +194,7 @@ KTp::Message KTp::MessageProcessor::processIncomingMessage(const \
Tp::ReceivedMes  KTp::Message MessageProcessor::processIncomingMessage(KTp::Message \
message, const KTp::MessageContext &context)  {
     Q_FOREACH (const FilterPlugin &plugin, d->filters) {
-        qCDebug(KTP_COMMONINTERNALS) << "running filter :" << \
plugin.instance->metaObject()->className(); +        qCDebug(KTP_MESSAGEPROCESSOR) << \
"running filter:" << plugin.instance->metaObject()->className();  \
plugin.instance->filterMessage(message, context);  }
     return message;
@@ -206,7 +206,7 @@ KTp::OutgoingMessage \
MessageProcessor::processOutgoingMessage(const QString &mes  KTp::OutgoingMessage \
message(messageText);  
     Q_FOREACH (const FilterPlugin &plugin, d->filters) {
-        qCDebug(KTP_COMMONINTERNALS) << "running outgoing filter : " << \
plugin.instance->metaObject()->className(); +        qCDebug(KTP_MESSAGEPROCESSOR) << \
"running outgoing filter: " << plugin.instance->metaObject()->className();  \
plugin.instance->filterOutgoingMessage(message, context);  }
 
diff --git a/KTp/message-processor.h b/KTp/message-processor.h
index d2afc58..da6f375 100644
--- a/KTp/message-processor.h
+++ b/KTp/message-processor.h
@@ -22,6 +22,7 @@
 
 #include <QObject>
 #include <QList>
+#include <QLoggingCategory>
 #include <KPluginInfo>
 
 #include <KTp/message.h>
@@ -30,6 +31,8 @@
 #include <KTp/ktpcommoninternals_export.h>
 #include <KTp/abstract-message-filter.h>
 
+Q_DECLARE_LOGGING_CATEGORY(KTP_MESSAGEPROCESSOR)
+
 namespace Tp
 {
 class ReceivedMessage;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic