From da2b049e248c1ad7efeb53685158a205335e4e36 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Thu, 7 Jul 2016 22:23:49 +0200 Subject: 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. --- common/domain/applicationdomaintype.cpp | 8 +++++--- common/domain/folder.cpp | 4 +++- common/domain/mail.cpp | 4 +++- 3 files changed, 11 insertions(+), 5 deletions(-) (limited to 'common/domain') diff --git a/common/domain/applicationdomaintype.cpp b/common/domain/applicationdomaintype.cpp index 44eeb13..57919ff 100644 --- a/common/domain/applicationdomaintype.cpp +++ b/common/domain/applicationdomaintype.cpp @@ -24,6 +24,8 @@ #include "storage.h" //for generateUid() #include +SINK_DEBUG_AREA("applicationdomaintype"); + namespace Sink { namespace ApplicationDomain { @@ -82,7 +84,7 @@ QVariant ApplicationDomainType::getProperty(const QByteArray &key) const { Q_ASSERT(mAdaptor); if (!mAdaptor->availableProperties().contains(key)) { - Warning() << "No such property available " << key; + SinkWarning() << "No such property available " << key; } return mAdaptor->getProperty(key); } @@ -105,7 +107,7 @@ QByteArray ApplicationDomainType::getBlobProperty(const QByteArray &key) const const auto path = getProperty(key).toByteArray(); QFile file(path); if (!file.open(QIODevice::ReadOnly)) { - ErrorMsg() << "Failed to open the file: " << file.errorString() << path; + SinkError() << "Failed to open the file: " << file.errorString() << path; return QByteArray(); } return file.readAll(); @@ -116,7 +118,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)) { - ErrorMsg() << "Failed to open the file: " << file.errorString() << path; + SinkError() << "Failed to open the file: " << file.errorString() << path; return; } file.write(value); diff --git a/common/domain/folder.cpp b/common/domain/folder.cpp index 309ca3f..ddb0c10 100644 --- a/common/domain/folder.cpp +++ b/common/domain/folder.cpp @@ -35,6 +35,8 @@ #include "folder_generated.h" +SINK_DEBUG_AREA("folder"); + static QMutex sMutex; using namespace Sink::ApplicationDomain; @@ -58,7 +60,7 @@ ResultSet TypeImplementation::queryIndexes(const Sink::Query &query, con void TypeImplementation::index(const QByteArray &identifier, const BufferAdaptor &bufferAdaptor, Sink::Storage::Transaction &transaction) { - Trace() << "Indexing " << identifier; + SinkTrace() << "Indexing " << identifier; getIndex().add(identifier, bufferAdaptor, transaction); } diff --git a/common/domain/mail.cpp b/common/domain/mail.cpp index 5b35a9a..13e1305 100644 --- a/common/domain/mail.cpp +++ b/common/domain/mail.cpp @@ -35,6 +35,8 @@ #include "mail_generated.h" +SINK_DEBUG_AREA("mail"); + static QMutex sMutex; using namespace Sink::ApplicationDomain; @@ -63,7 +65,7 @@ ResultSet TypeImplementation::queryIndexes(const Sink::Query &query, const void TypeImplementation::index(const QByteArray &identifier, const BufferAdaptor &bufferAdaptor, Sink::Storage::Transaction &transaction) { - Trace() << "Indexing " << identifier; + SinkTrace() << "Indexing " << identifier; getIndex().add(identifier, bufferAdaptor, transaction); } -- cgit v1.2.3