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/storage_common.cpp | |
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/storage_common.cpp')
-rw-r--r-- | common/storage_common.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/common/storage_common.cpp b/common/storage_common.cpp index 6982a4c..1f2594e 100644 --- a/common/storage_common.cpp +++ b/common/storage_common.cpp | |||
@@ -24,6 +24,8 @@ | |||
24 | #include "log.h" | 24 | #include "log.h" |
25 | #include <QUuid> | 25 | #include <QUuid> |
26 | 26 | ||
27 | SINK_DEBUG_AREA("storage") | ||
28 | |||
27 | namespace Sink { | 29 | namespace Sink { |
28 | 30 | ||
29 | static const char *s_internalPrefix = "__internal"; | 31 | static const char *s_internalPrefix = "__internal"; |
@@ -31,7 +33,7 @@ static const int s_internalPrefixSize = strlen(s_internalPrefix); | |||
31 | 33 | ||
32 | void errorHandler(const Storage::Error &error) | 34 | void errorHandler(const Storage::Error &error) |
33 | { | 35 | { |
34 | Warning() << "Database error in " << error.store << ", code " << error.code << ", message: " << error.message; | 36 | SinkWarning() << "Database error in " << error.store << ", code " << error.code << ", message: " << error.message; |
35 | } | 37 | } |
36 | 38 | ||
37 | std::function<void(const Storage::Error &error)> Storage::basicErrorHandler() | 39 | std::function<void(const Storage::Error &error)> Storage::basicErrorHandler() |
@@ -67,7 +69,7 @@ qint64 Storage::maxRevision(const Sink::Storage::Transaction &transaction) | |||
67 | }, | 69 | }, |
68 | [](const Error &error) { | 70 | [](const Error &error) { |
69 | if (error.code != Sink::Storage::NotFound) { | 71 | if (error.code != Sink::Storage::NotFound) { |
70 | Warning() << "Coultn'd find the maximum revision."; | 72 | SinkWarning() << "Coultn'd find the maximum revision."; |
71 | } | 73 | } |
72 | }); | 74 | }); |
73 | return r; | 75 | return r; |
@@ -88,7 +90,7 @@ qint64 Storage::cleanedUpRevision(const Sink::Storage::Transaction &transaction) | |||
88 | }, | 90 | }, |
89 | [](const Error &error) { | 91 | [](const Error &error) { |
90 | if (error.code != Sink::Storage::NotFound) { | 92 | if (error.code != Sink::Storage::NotFound) { |
91 | Warning() << "Coultn'd find the maximum revision."; | 93 | SinkWarning() << "Coultn'd find the maximum revision."; |
92 | } | 94 | } |
93 | }); | 95 | }); |
94 | return r; | 96 | return r; |
@@ -103,7 +105,7 @@ QByteArray Storage::getUidFromRevision(const Sink::Storage::Transaction &transac | |||
103 | uid = value; | 105 | uid = value; |
104 | return false; | 106 | return false; |
105 | }, | 107 | }, |
106 | [revision](const Error &error) { Warning() << "Coultn'd find uid for revision: " << revision << error.message; }); | 108 | [revision](const Error &error) { SinkWarning() << "Coultn'd find uid for revision: " << revision << error.message; }); |
107 | return uid; | 109 | return uid; |
108 | } | 110 | } |
109 | 111 | ||
@@ -116,7 +118,7 @@ QByteArray Storage::getTypeFromRevision(const Sink::Storage::Transaction &transa | |||
116 | type = value; | 118 | type = value; |
117 | return false; | 119 | return false; |
118 | }, | 120 | }, |
119 | [revision](const Error &error) { Warning() << "Coultn'd find type for revision " << revision; }); | 121 | [revision](const Error &error) { SinkWarning() << "Coultn'd find type for revision " << revision; }); |
120 | return type; | 122 | return type; |
121 | } | 123 | } |
122 | 124 | ||