diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-07-07 22:23:49 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-07-07 22:23:49 +0200 |
commit | da2b049e248c1ad7efeb53685158a205335e4e36 (patch) | |
tree | 1e7e5e940e9b760b2108081b1d2f3879cebdb0ff /common/domain | |
parent | 9bcb822963fc96c94dbe7dcc4134dcd2dac454ff (diff) | |
download | sink-da2b049e248c1ad7efeb53685158a205335e4e36.tar.gz sink-da2b049e248c1ad7efeb53685158a205335e4e36.zip |
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.
Diffstat (limited to 'common/domain')
-rw-r--r-- | common/domain/applicationdomaintype.cpp | 8 | ||||
-rw-r--r-- | common/domain/folder.cpp | 4 | ||||
-rw-r--r-- | common/domain/mail.cpp | 4 |
3 files changed, 11 insertions, 5 deletions
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 @@ | |||
24 | #include "storage.h" //for generateUid() | 24 | #include "storage.h" //for generateUid() |
25 | #include <QFile> | 25 | #include <QFile> |
26 | 26 | ||
27 | SINK_DEBUG_AREA("applicationdomaintype"); | ||
28 | |||
27 | namespace Sink { | 29 | namespace Sink { |
28 | namespace ApplicationDomain { | 30 | namespace ApplicationDomain { |
29 | 31 | ||
@@ -82,7 +84,7 @@ QVariant ApplicationDomainType::getProperty(const QByteArray &key) const | |||
82 | { | 84 | { |
83 | Q_ASSERT(mAdaptor); | 85 | Q_ASSERT(mAdaptor); |
84 | if (!mAdaptor->availableProperties().contains(key)) { | 86 | if (!mAdaptor->availableProperties().contains(key)) { |
85 | Warning() << "No such property available " << key; | 87 | SinkWarning() << "No such property available " << key; |
86 | } | 88 | } |
87 | return mAdaptor->getProperty(key); | 89 | return mAdaptor->getProperty(key); |
88 | } | 90 | } |
@@ -105,7 +107,7 @@ QByteArray ApplicationDomainType::getBlobProperty(const QByteArray &key) const | |||
105 | const auto path = getProperty(key).toByteArray(); | 107 | const auto path = getProperty(key).toByteArray(); |
106 | QFile file(path); | 108 | QFile file(path); |
107 | if (!file.open(QIODevice::ReadOnly)) { | 109 | if (!file.open(QIODevice::ReadOnly)) { |
108 | ErrorMsg() << "Failed to open the file: " << file.errorString() << path; | 110 | SinkError() << "Failed to open the file: " << file.errorString() << path; |
109 | return QByteArray(); | 111 | return QByteArray(); |
110 | } | 112 | } |
111 | return file.readAll(); | 113 | return file.readAll(); |
@@ -116,7 +118,7 @@ void ApplicationDomainType::setBlobProperty(const QByteArray &key, const QByteAr | |||
116 | const auto path = Sink::temporaryFileLocation() + "/" + QUuid::createUuid().toString(); | 118 | const auto path = Sink::temporaryFileLocation() + "/" + QUuid::createUuid().toString(); |
117 | QFile file(path); | 119 | QFile file(path); |
118 | if (!file.open(QIODevice::WriteOnly)) { | 120 | if (!file.open(QIODevice::WriteOnly)) { |
119 | ErrorMsg() << "Failed to open the file: " << file.errorString() << path; | 121 | SinkError() << "Failed to open the file: " << file.errorString() << path; |
120 | return; | 122 | return; |
121 | } | 123 | } |
122 | file.write(value); | 124 | 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 @@ | |||
35 | 35 | ||
36 | #include "folder_generated.h" | 36 | #include "folder_generated.h" |
37 | 37 | ||
38 | SINK_DEBUG_AREA("folder"); | ||
39 | |||
38 | static QMutex sMutex; | 40 | static QMutex sMutex; |
39 | 41 | ||
40 | using namespace Sink::ApplicationDomain; | 42 | using namespace Sink::ApplicationDomain; |
@@ -58,7 +60,7 @@ ResultSet TypeImplementation<Folder>::queryIndexes(const Sink::Query &query, con | |||
58 | 60 | ||
59 | void TypeImplementation<Folder>::index(const QByteArray &identifier, const BufferAdaptor &bufferAdaptor, Sink::Storage::Transaction &transaction) | 61 | void TypeImplementation<Folder>::index(const QByteArray &identifier, const BufferAdaptor &bufferAdaptor, Sink::Storage::Transaction &transaction) |
60 | { | 62 | { |
61 | Trace() << "Indexing " << identifier; | 63 | SinkTrace() << "Indexing " << identifier; |
62 | getIndex().add(identifier, bufferAdaptor, transaction); | 64 | getIndex().add(identifier, bufferAdaptor, transaction); |
63 | } | 65 | } |
64 | 66 | ||
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 @@ | |||
35 | 35 | ||
36 | #include "mail_generated.h" | 36 | #include "mail_generated.h" |
37 | 37 | ||
38 | SINK_DEBUG_AREA("mail"); | ||
39 | |||
38 | static QMutex sMutex; | 40 | static QMutex sMutex; |
39 | 41 | ||
40 | using namespace Sink::ApplicationDomain; | 42 | using namespace Sink::ApplicationDomain; |
@@ -63,7 +65,7 @@ ResultSet TypeImplementation<Mail>::queryIndexes(const Sink::Query &query, const | |||
63 | 65 | ||
64 | void TypeImplementation<Mail>::index(const QByteArray &identifier, const BufferAdaptor &bufferAdaptor, Sink::Storage::Transaction &transaction) | 66 | void TypeImplementation<Mail>::index(const QByteArray &identifier, const BufferAdaptor &bufferAdaptor, Sink::Storage::Transaction &transaction) |
65 | { | 67 | { |
66 | Trace() << "Indexing " << identifier; | 68 | SinkTrace() << "Indexing " << identifier; |
67 | getIndex().add(identifier, bufferAdaptor, transaction); | 69 | getIndex().add(identifier, bufferAdaptor, transaction); |
68 | } | 70 | } |
69 | 71 | ||