From 4983c40b580a2421c9be43760e6a8bebdb156ef3 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Wed, 18 Jan 2017 16:02:40 +0100 Subject: Debug output --- common/domain/applicationdomaintype.cpp | 4 ++-- common/index.cpp | 2 +- common/synchronizer.cpp | 6 +++++- common/synchronizerstore.cpp | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) (limited to 'common') diff --git a/common/domain/applicationdomaintype.cpp b/common/domain/applicationdomaintype.cpp index 75438d5..1647951 100644 --- a/common/domain/applicationdomaintype.cpp +++ b/common/domain/applicationdomaintype.cpp @@ -150,7 +150,7 @@ QByteArray ApplicationDomainType::getBlobProperty(const QByteArray &key) const const auto path = getProperty(key).value().value; QFile file(path); if (!file.open(QIODevice::ReadOnly)) { - SinkError() << "Failed to open the file: " << file.errorString() << path; + SinkError() << "Failed to open the file for reading: " << file.errorString() << path << " For property " << key; return QByteArray(); } return file.readAll(); @@ -161,7 +161,7 @@ void ApplicationDomainType::setBlobProperty(const QByteArray &key, const QByteAr const auto path = Sink::temporaryFileLocation() + "/" + QUuid::createUuid().toString(); QFile file(path); if (!file.open(QIODevice::WriteOnly)) { - SinkError() << "Failed to open the file: " << file.errorString() << path; + SinkError() << "Failed to open the file for writing: " << file.errorString() << path<< " For property " << key; return; } file.write(value); diff --git a/common/index.cpp b/common/index.cpp index c864e77..f3d05f1 100644 --- a/common/index.cpp +++ b/common/index.cpp @@ -44,6 +44,6 @@ QByteArray Index::lookup(const QByteArray &key) { QByteArray result; //We have to create a deep copy, otherwise the returned data may become invalid when the transaction ends. - lookup(key, [&result](const QByteArray &value) { result = QByteArray(value.constData(), value.size()); }, [this](const Index::Error &error) { SinkTrace() << "Error while retrieving value" << error.message; }); + lookup(key, [&result](const QByteArray &value) { result = QByteArray(value.constData(), value.size()); }, [this](const Index::Error &error) { SinkWarning() << "Error while retrieving value" << error.message; }); return result; } diff --git a/common/synchronizer.cpp b/common/synchronizer.cpp index d86b027..d94083b 100644 --- a/common/synchronizer.cpp +++ b/common/synchronizer.cpp @@ -277,6 +277,7 @@ void Synchronizer::flush(int commandId, const QByteArray &flushId) KAsync::Job Synchronizer::processSyncQueue() { if (mSyncRequestQueue.isEmpty() || mSyncInProgress) { + SinkTrace() << "Sync still in progress or nothing to do."; return KAsync::null(); } @@ -285,7 +286,7 @@ KAsync::Job Synchronizer::processSyncQueue() mSyncInProgress = true; }); while (!mSyncRequestQueue.isEmpty()) { - auto request = mSyncRequestQueue.takeFirst(); + const auto request = mSyncRequestQueue.takeFirst(); if (request.requestType == Synchronizer::SyncRequest::Synchronization) { job = job.then([this, request] { Sink::Notification n; @@ -343,6 +344,7 @@ KAsync::Job Synchronizer::processSyncQueue() } } return job.then([this](const KAsync::Error &error) { + SinkTrace() << "Sync request processed"; mSyncTransaction.abort(); mMessageQueue->commit(); mSyncStore.clear(); @@ -446,6 +448,8 @@ KAsync::Job Synchronizer::replay(const QByteArray &type, const QByteArray } else if (type == ApplicationDomain::getTypeName()) { auto mail = store().readEntity(key); job = replay(mail, operation, oldRemoteId, modifiedProperties); + } else { + SinkError() << "Replayed unknown type: " << type; } return job.then([this, operation, type, uid, oldRemoteId](const QByteArray &remoteId) { diff --git a/common/synchronizerstore.cpp b/common/synchronizerstore.cpp index 31c1391..dea4821 100644 --- a/common/synchronizerstore.cpp +++ b/common/synchronizerstore.cpp @@ -73,7 +73,7 @@ QByteArray SynchronizerStore::resolveLocalId(const QByteArray &bufferType, const { QByteArray remoteId = Index("localid.mapping." + bufferType, mTransaction).lookup(localId); if (remoteId.isEmpty()) { - SinkWarning() << "Couldn't find the remote id for " << localId; + SinkWarning() << "Couldn't find the remote id for " << bufferType << localId; return QByteArray(); } return remoteId; -- cgit v1.2.3