diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-01-07 17:58:48 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-01-07 17:58:48 +0100 |
commit | 3aab8be81f96e8a32a1edc09b836e6c0264d39e7 (patch) | |
tree | 0acef21cde8c913ed2a1bd8a1cb9cf41dc372a57 | |
parent | 35a3afc591c85999de856c21dbb493e341951d91 (diff) | |
download | sink-3aab8be81f96e8a32a1edc09b836e6c0264d39e7.tar.gz sink-3aab8be81f96e8a32a1edc09b836e6c0264d39e7.zip |
Debug output
-rw-r--r-- | common/log.cpp | 2 | ||||
-rw-r--r-- | common/modelresult.cpp | 4 | ||||
-rw-r--r-- | common/query.cpp | 2 | ||||
-rw-r--r-- | common/storage.h | 3 | ||||
-rw-r--r-- | common/storage_common.cpp | 6 | ||||
-rw-r--r-- | common/synchronizer.cpp | 2 |
6 files changed, 17 insertions, 2 deletions
diff --git a/common/log.cpp b/common/log.cpp index c677521..9dd0365 100644 --- a/common/log.cpp +++ b/common/log.cpp | |||
@@ -275,6 +275,8 @@ static bool containsItemStartingWith(const QByteArray &pattern, const QByteArray | |||
275 | for (const auto &item : list) { | 275 | for (const auto &item : list) { |
276 | if (item.startsWith('*')) { | 276 | if (item.startsWith('*')) { |
277 | auto stripped = item.mid(1); | 277 | auto stripped = item.mid(1); |
278 | stripped.endsWith('*'); | ||
279 | stripped.chop(1); | ||
278 | if (pattern.contains(stripped)) { | 280 | if (pattern.contains(stripped)) { |
279 | return true; | 281 | return true; |
280 | } | 282 | } |
diff --git a/common/modelresult.cpp b/common/modelresult.cpp index b738a05..695072c 100644 --- a/common/modelresult.cpp +++ b/common/modelresult.cpp | |||
@@ -260,6 +260,7 @@ void ModelResult<T, Ptr>::setEmitter(const typename Sink::ResultEmitter<Ptr>::Pt | |||
260 | setFetcher([this](const Ptr &parent) { mEmitter->fetch(parent); }); | 260 | setFetcher([this](const Ptr &parent) { mEmitter->fetch(parent); }); |
261 | 261 | ||
262 | emitter->onAdded([this](const Ptr &value) { | 262 | emitter->onAdded([this](const Ptr &value) { |
263 | SinkTraceCtx(mLogCtx) << "Received addition: " << value->identifier(); | ||
263 | threadBoundary.callInMainThread([this, value]() { | 264 | threadBoundary.callInMainThread([this, value]() { |
264 | add(value); | 265 | add(value); |
265 | }); | 266 | }); |
@@ -271,6 +272,7 @@ void ModelResult<T, Ptr>::setEmitter(const typename Sink::ResultEmitter<Ptr>::Pt | |||
271 | }); | 272 | }); |
272 | }); | 273 | }); |
273 | emitter->onRemoved([this](const Ptr &value) { | 274 | emitter->onRemoved([this](const Ptr &value) { |
275 | SinkTraceCtx(mLogCtx) << "Received removal: " << value->identifier(); | ||
274 | threadBoundary.callInMainThread([this, value]() { | 276 | threadBoundary.callInMainThread([this, value]() { |
275 | remove(value); | 277 | remove(value); |
276 | }); | 278 | }); |
@@ -310,7 +312,7 @@ void ModelResult<T, Ptr>::modify(const Ptr &value) | |||
310 | return; | 312 | return; |
311 | } | 313 | } |
312 | auto parent = createIndexFromId(id); | 314 | auto parent = createIndexFromId(id); |
313 | SinkTraceCtx(mLogCtx) << "Modified entity" << childId; | 315 | SinkTraceCtx(mLogCtx) << "Modified entity:" << value->identifier() << ", id: " << childId; |
314 | auto i = mTree[id].indexOf(childId); | 316 | auto i = mTree[id].indexOf(childId); |
315 | Q_ASSERT(i >= 0); | 317 | Q_ASSERT(i >= 0); |
316 | mEntities.remove(childId); | 318 | mEntities.remove(childId); |
diff --git a/common/query.cpp b/common/query.cpp index 940c596..3dc8f99 100644 --- a/common/query.cpp +++ b/common/query.cpp | |||
@@ -32,6 +32,8 @@ QDebug operator<<(QDebug dbg, const Sink::QueryBase::Comparator &c) | |||
32 | dbg.nospace() << "== " << c.value; | 32 | dbg.nospace() << "== " << c.value; |
33 | } else if (c.comparator == Sink::Query::Comparator::Contains) { | 33 | } else if (c.comparator == Sink::Query::Comparator::Contains) { |
34 | dbg.nospace() << "contains " << c.value; | 34 | dbg.nospace() << "contains " << c.value; |
35 | } else if (c.comparator == Sink::Query::Comparator::In) { | ||
36 | dbg.nospace() << "in " << c.value; | ||
35 | } else { | 37 | } else { |
36 | dbg.nospace() << "unknown comparator: " << c.value; | 38 | dbg.nospace() << "unknown comparator: " << c.value; |
37 | } | 39 | } |
diff --git a/common/storage.h b/common/storage.h index e368b05..039a54f 100644 --- a/common/storage.h +++ b/common/storage.h | |||
@@ -214,3 +214,6 @@ private: | |||
214 | 214 | ||
215 | } | 215 | } |
216 | } // namespace Sink | 216 | } // namespace Sink |
217 | |||
218 | QDebug& SINK_EXPORT operator<<(QDebug &dbg, const Sink::Storage::DataStore::Error &error); | ||
219 | |||
diff --git a/common/storage_common.cpp b/common/storage_common.cpp index 60ef83d..3951a81 100644 --- a/common/storage_common.cpp +++ b/common/storage_common.cpp | |||
@@ -26,6 +26,12 @@ | |||
26 | 26 | ||
27 | SINK_DEBUG_AREA("storage") | 27 | SINK_DEBUG_AREA("storage") |
28 | 28 | ||
29 | QDebug& operator<<(QDebug &dbg, const Sink::Storage::DataStore::Error &error) | ||
30 | { | ||
31 | dbg << error.message; | ||
32 | return dbg; | ||
33 | } | ||
34 | |||
29 | namespace Sink { | 35 | namespace Sink { |
30 | namespace Storage { | 36 | namespace Storage { |
31 | 37 | ||
diff --git a/common/synchronizer.cpp b/common/synchronizer.cpp index df36ef0..a4e64c9 100644 --- a/common/synchronizer.cpp +++ b/common/synchronizer.cpp | |||
@@ -293,7 +293,7 @@ KAsync::Job<void> Synchronizer::processSyncQueue() | |||
293 | n.message = "Synchronization has started."; | 293 | n.message = "Synchronization has started."; |
294 | n.code = ApplicationDomain::BusyStatus; | 294 | n.code = ApplicationDomain::BusyStatus; |
295 | emit notify(n); | 295 | emit notify(n); |
296 | SinkLogCtx(mLogCtx) << "Synchronizing " << request.query.type(); | 296 | SinkLogCtx(mLogCtx) << "Synchronizing " << request.query; |
297 | }).then(synchronizeWithSource(request.query)).syncThen<void>([this] { | 297 | }).then(synchronizeWithSource(request.query)).syncThen<void>([this] { |
298 | //Commit after every request, so implementations only have to commit more if they add a lot of data. | 298 | //Commit after every request, so implementations only have to commit more if they add a lot of data. |
299 | commit(); | 299 | commit(); |