summaryrefslogtreecommitdiffstats
path: root/common/test.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2016-07-07 22:23:49 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2016-07-07 22:23:49 +0200
commitda2b049e248c1ad7efeb53685158a205335e4e36 (patch)
tree1e7e5e940e9b760b2108081b1d2f3879cebdb0ff /common/test.cpp
parent9bcb822963fc96c94dbe7dcc4134dcd2dac454ff (diff)
downloadsink-da2b049e248c1ad7efeb53685158a205335e4e36.tar.gz
sink-da2b049e248c1ad7efeb53685158a205335e4e36.zip
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.
Diffstat (limited to 'common/test.cpp')
-rw-r--r--common/test.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/common/test.cpp b/common/test.cpp
index c7d84cc..99e51c8 100644
--- a/common/test.cpp
+++ b/common/test.cpp
@@ -28,6 +28,8 @@
28#include "query.h" 28#include "query.h"
29#include "resourceconfig.h" 29#include "resourceconfig.h"
30 30
31SINK_DEBUG_AREA("test")
32
31using namespace Sink; 33using namespace Sink;
32 34
33void Sink::Test::initTest() 35void Sink::Test::initTest()
@@ -103,7 +105,7 @@ public:
103 { 105 {
104 auto resultProvider = new Sink::ResultProvider<typename T::Ptr>(); 106 auto resultProvider = new Sink::ResultProvider<typename T::Ptr>();
105 resultProvider->onDone([resultProvider]() { 107 resultProvider->onDone([resultProvider]() {
106 Trace() << "Result provider is done"; 108 SinkTrace() << "Result provider is done";
107 delete resultProvider; 109 delete resultProvider;
108 }); 110 });
109 // We have to do it this way, otherwise we're not setting the fetcher right 111 // We have to do it this way, otherwise we're not setting the fetcher right
@@ -111,11 +113,11 @@ public:
111 113
112 resultProvider->setFetcher([query, resultProvider, this](const typename T::Ptr &parent) { 114 resultProvider->setFetcher([query, resultProvider, this](const typename T::Ptr &parent) {
113 if (parent) { 115 if (parent) {
114 Trace() << "Running the fetcher " << parent->identifier(); 116 SinkTrace() << "Running the fetcher " << parent->identifier();
115 } else { 117 } else {
116 Trace() << "Running the fetcher."; 118 SinkTrace() << "Running the fetcher.";
117 } 119 }
118 Trace() << "-------------------------."; 120 SinkTrace() << "-------------------------.";
119 for (const auto &res : mTestAccount->entities<T>()) { 121 for (const auto &res : mTestAccount->entities<T>()) {
120 qDebug() << "Parent filter " << query.propertyFilter.value("parent").value.toByteArray() << res->identifier() << res->getProperty("parent").toByteArray(); 122 qDebug() << "Parent filter " << query.propertyFilter.value("parent").value.toByteArray() << res->identifier() << res->getProperty("parent").toByteArray();
121 auto parentProperty = res->getProperty("parent").toByteArray(); 123 auto parentProperty = res->getProperty("parent").toByteArray();