diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-05-01 23:50:00 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-05-01 23:50:00 +0200 |
commit | 4bbb92fd179fc00258264bd488270179ff246510 (patch) | |
tree | 25e67f00ca92c3ae61c487d6bb64c600b56d3058 /common/resourceaccess.cpp | |
parent | 0aee555ae75e51802e5193c96b2e492007a15a52 (diff) | |
download | sink-4bbb92fd179fc00258264bd488270179ff246510.tar.gz sink-4bbb92fd179fc00258264bd488270179ff246510.zip |
Logging
Diffstat (limited to 'common/resourceaccess.cpp')
-rw-r--r-- | common/resourceaccess.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/common/resourceaccess.cpp b/common/resourceaccess.cpp index f448897..b7d569b 100644 --- a/common/resourceaccess.cpp +++ b/common/resourceaccess.cpp | |||
@@ -33,6 +33,11 @@ | |||
33 | #include <QDir> | 33 | #include <QDir> |
34 | #include <QProcess> | 34 | #include <QProcess> |
35 | 35 | ||
36 | #undef Trace | ||
37 | #define Trace() debugStream(DebugLevel::Trace, __LINE__, __FILE__, Q_FUNC_INFO, "ResourceAccess") | ||
38 | #undef Log | ||
39 | #define Log(IDENTIFIER) debugStream(DebugLevel::Log, __LINE__, __FILE__, Q_FUNC_INFO, "ResourceAccess("+IDENTIFIER+")") | ||
40 | |||
36 | namespace Akonadi2 | 41 | namespace Akonadi2 |
37 | { | 42 | { |
38 | 43 | ||
@@ -163,6 +168,7 @@ ResourceAccess::ResourceAccess(const QByteArray &resourceName, QObject *parent) | |||
163 | 168 | ||
164 | ResourceAccess::~ResourceAccess() | 169 | ResourceAccess::~ResourceAccess() |
165 | { | 170 | { |
171 | log("Closing access"); | ||
166 | if (!d->resultHandler.isEmpty()) { | 172 | if (!d->resultHandler.isEmpty()) { |
167 | Warning() << "Left jobs running while shutting down ResourceAccess"; | 173 | Warning() << "Left jobs running while shutting down ResourceAccess"; |
168 | } | 174 | } |
@@ -310,7 +316,7 @@ void ResourceAccess::disconnected() | |||
310 | void ResourceAccess::connectionError(QLocalSocket::LocalSocketError error) | 316 | void ResourceAccess::connectionError(QLocalSocket::LocalSocketError error) |
311 | { | 317 | { |
312 | if (error == QLocalSocket::PeerClosedError) { | 318 | if (error == QLocalSocket::PeerClosedError) { |
313 | Log() << "The resource closed the connection."; | 319 | Log(d->resourceName) << "The resource closed the connection."; |
314 | } else { | 320 | } else { |
315 | Warning() << QString("Connection error: %1 : %2").arg(error).arg(d->socket->errorString()); | 321 | Warning() << QString("Connection error: %1 : %2").arg(error).arg(d->socket->errorString()); |
316 | } | 322 | } |
@@ -325,6 +331,7 @@ void ResourceAccess::connectionError(QLocalSocket::LocalSocketError error) | |||
325 | void ResourceAccess::readResourceMessage() | 331 | void ResourceAccess::readResourceMessage() |
326 | { | 332 | { |
327 | if (!d->socket || !d->socket->isValid()) { | 333 | if (!d->socket || !d->socket->isValid()) { |
334 | Warning() << "No socket available"; | ||
328 | return; | 335 | return; |
329 | } | 336 | } |
330 | 337 | ||
@@ -372,7 +379,7 @@ bool ResourceAccess::processMessageBuffer() | |||
372 | auto buffer = GetNotification(d->partialMessageBuffer.constData() + headerSize); | 379 | auto buffer = GetNotification(d->partialMessageBuffer.constData() + headerSize); |
373 | switch (buffer->type()) { | 380 | switch (buffer->type()) { |
374 | case Akonadi2::NotificationType::NotificationType_Shutdown: | 381 | case Akonadi2::NotificationType::NotificationType_Shutdown: |
375 | Log() << "Received shutdown notification."; | 382 | Log(d->resourceName) << "Received shutdown notification."; |
376 | close(); | 383 | close(); |
377 | break; | 384 | break; |
378 | default: | 385 | default: |
@@ -399,7 +406,7 @@ void ResourceAccess::callCallbacks(int id) | |||
399 | 406 | ||
400 | void ResourceAccess::log(const QString &message) | 407 | void ResourceAccess::log(const QString &message) |
401 | { | 408 | { |
402 | Log() << d->resourceName + ": " + message; | 409 | Log(d->resourceName) << this << message; |
403 | } | 410 | } |
404 | 411 | ||
405 | } | 412 | } |