summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Klapetek <mklapetek@kde.org>2016-03-17 22:25:37 (GMT)
committerAlexandr Akulich <akulichalexander@gmail.com>2016-09-21 14:26:51 (GMT)
commit769e7a06ddfbc9adce044105b1af8e9c548c6080 (patch)
treec36445f2ecfcb9d068520f2b04da31d78d4b2323
parent7e11a99b4f096a4857ab842e4da9eb162c48950d (diff)
[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) Reviewed-by: Alexandr Akulich <akulichalexander@gmail.com>
-rw-r--r--KTp/message-processor.cpp20
-rw-r--r--KTp/message-processor.h3
2 files changed, 13 insertions, 10 deletions
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;