diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-12-22 18:22:39 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-12-22 18:22:39 +0100 |
commit | b2ad8f785e801a35cadf254d827f56d648be510c (patch) | |
tree | 4eeb1e3eefb02c40dac40469c0fae5ad91feb3e3 /tests/clientapitest.cpp | |
parent | 1fe8664ec74165fc3f250098609ea0e049e3adc8 (diff) | |
download | sink-b2ad8f785e801a35cadf254d827f56d648be510c.tar.gz sink-b2ad8f785e801a35cadf254d827f56d648be510c.zip |
Introduced Log::Context
To have hierarchical debug output we have to pass around something at
run-time, there is no reasonable alternative. Log::Context provides the
identifier to do just that and largely replaces the debug component
idea.
Diffstat (limited to 'tests/clientapitest.cpp')
-rw-r--r-- | tests/clientapitest.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/tests/clientapitest.cpp b/tests/clientapitest.cpp index d2fb747..544b981 100644 --- a/tests/clientapitest.cpp +++ b/tests/clientapitest.cpp | |||
@@ -53,28 +53,28 @@ public: | |||
53 | { | 53 | { |
54 | return KAsync::null<void>(); | 54 | return KAsync::null<void>(); |
55 | }; | 55 | }; |
56 | QPair<KAsync::Job<void>, typename Sink::ResultEmitter<typename T::Ptr>::Ptr> load(const Sink::Query &query) Q_DECL_OVERRIDE | 56 | QPair<KAsync::Job<void>, typename Sink::ResultEmitter<typename T::Ptr>::Ptr> load(const Sink::Query &query, const Sink::Log::Context &ctx) Q_DECL_OVERRIDE |
57 | { | 57 | { |
58 | auto resultProvider = new Sink::ResultProvider<typename T::Ptr>(); | 58 | auto resultProvider = new Sink::ResultProvider<typename T::Ptr>(); |
59 | resultProvider->onDone([resultProvider]() { | 59 | resultProvider->onDone([resultProvider,ctx]() { |
60 | SinkTrace() << "Result provider is done"; | 60 | SinkTraceCtx(ctx) << "Result provider is done"; |
61 | delete resultProvider; | 61 | delete resultProvider; |
62 | }); | 62 | }); |
63 | // We have to do it this way, otherwise we're not setting the fetcher right | 63 | // We have to do it this way, otherwise we're not setting the fetcher right |
64 | auto emitter = resultProvider->emitter(); | 64 | auto emitter = resultProvider->emitter(); |
65 | 65 | ||
66 | resultProvider->setFetcher([query, resultProvider, this](const typename T::Ptr &parent) { | 66 | resultProvider->setFetcher([query, resultProvider, this, ctx](const typename T::Ptr &parent) { |
67 | if (parent) { | 67 | if (parent) { |
68 | SinkTrace() << "Running the fetcher " << parent->identifier(); | 68 | SinkTraceCtx(ctx) << "Running the fetcher " << parent->identifier(); |
69 | } else { | 69 | } else { |
70 | SinkTrace() << "Running the fetcher."; | 70 | SinkTraceCtx(ctx) << "Running the fetcher."; |
71 | } | 71 | } |
72 | SinkTrace() << "-------------------------."; | 72 | SinkTraceCtx(ctx) << "-------------------------."; |
73 | for (const auto &res : results) { | 73 | for (const auto &res : results) { |
74 | qDebug() << "Parent filter " << query.getFilter("parent").value.toByteArray() << res->identifier() << res->getProperty("parent").toByteArray(); | 74 | SinkTraceCtx(ctx) << "Parent filter " << query.getFilter("parent").value.toByteArray() << res->identifier() << res->getProperty("parent").toByteArray(); |
75 | auto parentProperty = res->getProperty("parent").toByteArray(); | 75 | auto parentProperty = res->getProperty("parent").toByteArray(); |
76 | if ((!parent && parentProperty.isEmpty()) || (parent && parentProperty == parent->identifier()) || query.parentProperty().isEmpty()) { | 76 | if ((!parent && parentProperty.isEmpty()) || (parent && parentProperty == parent->identifier()) || query.parentProperty().isEmpty()) { |
77 | qDebug() << "Found a hit" << res->identifier(); | 77 | SinkTraceCtx(ctx) << "Found a hit" << res->identifier(); |
78 | resultProvider->add(res); | 78 | resultProvider->add(res); |
79 | } | 79 | } |
80 | } | 80 | } |