From 3aab8be81f96e8a32a1edc09b836e6c0264d39e7 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Sat, 7 Jan 2017 17:58:48 +0100 Subject: Debug output --- common/log.cpp | 2 ++ common/modelresult.cpp | 4 +++- common/query.cpp | 2 ++ common/storage.h | 3 +++ common/storage_common.cpp | 6 ++++++ 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 for (const auto &item : list) { if (item.startsWith('*')) { auto stripped = item.mid(1); + stripped.endsWith('*'); + stripped.chop(1); if (pattern.contains(stripped)) { return true; } 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::setEmitter(const typename Sink::ResultEmitter::Pt setFetcher([this](const Ptr &parent) { mEmitter->fetch(parent); }); emitter->onAdded([this](const Ptr &value) { + SinkTraceCtx(mLogCtx) << "Received addition: " << value->identifier(); threadBoundary.callInMainThread([this, value]() { add(value); }); @@ -271,6 +272,7 @@ void ModelResult::setEmitter(const typename Sink::ResultEmitter::Pt }); }); emitter->onRemoved([this](const Ptr &value) { + SinkTraceCtx(mLogCtx) << "Received removal: " << value->identifier(); threadBoundary.callInMainThread([this, value]() { remove(value); }); @@ -310,7 +312,7 @@ void ModelResult::modify(const Ptr &value) return; } auto parent = createIndexFromId(id); - SinkTraceCtx(mLogCtx) << "Modified entity" << childId; + SinkTraceCtx(mLogCtx) << "Modified entity:" << value->identifier() << ", id: " << childId; auto i = mTree[id].indexOf(childId); Q_ASSERT(i >= 0); 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) dbg.nospace() << "== " << c.value; } else if (c.comparator == Sink::Query::Comparator::Contains) { dbg.nospace() << "contains " << c.value; + } else if (c.comparator == Sink::Query::Comparator::In) { + dbg.nospace() << "in " << c.value; } else { dbg.nospace() << "unknown comparator: " << c.value; } 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: } } // namespace Sink + +QDebug& SINK_EXPORT operator<<(QDebug &dbg, const Sink::Storage::DataStore::Error &error); + 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 @@ SINK_DEBUG_AREA("storage") +QDebug& operator<<(QDebug &dbg, const Sink::Storage::DataStore::Error &error) +{ + dbg << error.message; + return dbg; +} + namespace Sink { namespace Storage { 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 Synchronizer::processSyncQueue() n.message = "Synchronization has started."; n.code = ApplicationDomain::BusyStatus; emit notify(n); - SinkLogCtx(mLogCtx) << "Synchronizing " << request.query.type(); + SinkLogCtx(mLogCtx) << "Synchronizing " << request.query; }).then(synchronizeWithSource(request.query)).syncThen([this] { //Commit after every request, so implementations only have to commit more if they add a lot of data. commit(); -- cgit v1.2.3