From da2b049e248c1ad7efeb53685158a205335e4e36 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Thu, 7 Jul 2016 22:23:49 +0200 Subject: A new debug system. Instead of a single #define as debug area the new system allows for an identifier for each debug message with the structure component.area. The component is a dot separated identifier of the runtime component, such as the process or the plugin. The area is the code component, and can be as such defined at compiletime. The idea of this system is that it becomes possible to i.e. look at the output of all messages in the query subsystem of a specific resource (something that happens in the client process, but in the resource-specific subcomponent). The new macros are supposed to be less likely to clash with other names, hence the new names. --- examples/dummyresource/resourcefactory.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'examples/dummyresource') diff --git a/examples/dummyresource/resourcefactory.cpp b/examples/dummyresource/resourcefactory.cpp index 21a76ad..0f7463f 100644 --- a/examples/dummyresource/resourcefactory.cpp +++ b/examples/dummyresource/resourcefactory.cpp @@ -48,6 +48,8 @@ #define ENTITY_TYPE_MAIL "mail" #define ENTITY_TYPE_FOLDER "folder" +SINK_DEBUG_AREA("dummyresource") + class DummySynchronizer : public Sink::Synchronizer { public: @@ -105,12 +107,12 @@ class DummySynchronizer : public Sink::Synchronizer { auto entity = createEntity(remoteId, it.value()); createOrModify(bufferType, remoteId, *entity); } - Trace() << "Sync of " << count << " entities of type " << bufferType << " done." << Sink::Log::TraceTime(time->elapsed()); + SinkTrace() << "Sync of " << count << " entities of type " << bufferType << " done." << Sink::Log::TraceTime(time->elapsed()); } KAsync::Job synchronizeWithSource() Q_DECL_OVERRIDE { - Log() << " Synchronizing with the source"; + SinkLog() << " Synchronizing with the source"; return KAsync::start([this]() { synchronize(ENTITY_TYPE_EVENT, DummyStore::instance().events(), [this](const QByteArray &ridBuffer, const QMap &data) { return createEvent(ridBuffer, data); @@ -121,7 +123,7 @@ class DummySynchronizer : public Sink::Synchronizer { synchronize(ENTITY_TYPE_FOLDER, DummyStore::instance().folders(), [this](const QByteArray &ridBuffer, const QMap &data) { return createFolder(ridBuffer, data); }); - Log() << "Done Synchronizing"; + SinkLog() << "Done Synchronizing"; }); } @@ -147,7 +149,7 @@ DummyResource::~DummyResource() KAsync::Job DummyResource::synchronizeWithSource() { - Trace() << "Synchronize with source and sending a notification about it"; + SinkTrace() << "Synchronize with source and sending a notification about it"; Sink::Notification n; n.id = "connected"; n.type = Sink::Notification::Status; @@ -160,7 +162,7 @@ KAsync::Job DummyResource::synchronizeWithSource() KAsync::Job DummyResource::inspect(int inspectionType, const QByteArray &inspectionId, const QByteArray &domainType, const QByteArray &entityId, const QByteArray &property, const QVariant &expectedValue) { - Trace() << "Inspecting " << inspectionType << domainType << entityId << property << expectedValue; + SinkTrace() << "Inspecting " << inspectionType << domainType << entityId << property << expectedValue; if (property == "testInspection") { if (expectedValue.toBool()) { //Success -- cgit v1.2.3