From 9a22126970a0e560e05ece5e8cdf7bb0ec5bc7eb Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Wed, 20 Jul 2016 09:46:37 +0200 Subject: Debug output --- common/pipeline.cpp | 6 ++--- docs/logging.md | 41 ++++++++++++++++++---------------- examples/imapresource/imapresource.cpp | 2 -- 3 files changed, 25 insertions(+), 24 deletions(-) diff --git a/common/pipeline.cpp b/common/pipeline.cpp index 000d2b2..1d45340 100644 --- a/common/pipeline.cpp +++ b/common/pipeline.cpp @@ -189,7 +189,7 @@ KAsync::Job Pipeline::newEntity(void const *command, size_t size) if (key.isEmpty()) { key = Sink::Storage::generateUid(); } - SinkLog() << "New Entity. Type: " << bufferType << "uid: "<< key << " replayToSource: " << replayToSource; + SinkTrace() << "New Entity. Type: " << bufferType << "uid: "<< key << " replayToSource: " << replayToSource; Q_ASSERT(!key.isEmpty()); { @@ -259,7 +259,7 @@ KAsync::Job Pipeline::modifiedEntity(void const *command, size_t size) const bool replayToSource = modifyEntity->replayToSource(); const QByteArray bufferType = QByteArray(reinterpret_cast(modifyEntity->domainType()->Data()), modifyEntity->domainType()->size()); const QByteArray key = QByteArray(reinterpret_cast(modifyEntity->entityId()->Data()), modifyEntity->entityId()->size()); - SinkLog() << "Modified Entity. Type: " << bufferType << "uid: "<< key << " replayToSource: " << replayToSource; + SinkTrace() << "Modified Entity. Type: " << bufferType << "uid: "<< key << " replayToSource: " << replayToSource; if (bufferType.isEmpty() || key.isEmpty()) { SinkWarning() << "entity type or key " << bufferType << key; return KAsync::error(0); @@ -365,7 +365,7 @@ KAsync::Job Pipeline::deletedEntity(void const *command, size_t size) const bool replayToSource = deleteEntity->replayToSource(); const QByteArray bufferType = QByteArray(reinterpret_cast(deleteEntity->domainType()->Data()), deleteEntity->domainType()->size()); const QByteArray key = QByteArray(reinterpret_cast(deleteEntity->entityId()->Data()), deleteEntity->entityId()->size()); - SinkLog() << "Deleted Entity. Type: " << bufferType << "uid: "<< key << " replayToSource: " << replayToSource; + SinkTrace() << "Deleted Entity. Type: " << bufferType << "uid: "<< key << " replayToSource: " << replayToSource; bool found = false; bool alreadyRemoved = false; diff --git a/docs/logging.md b/docs/logging.md index 3d5ea61..ac2ff25 100644 --- a/docs/logging.md +++ b/docs/logging.md @@ -18,25 +18,28 @@ This way we get complete logs also if some resource was not started from the con * warning: Only warnings, should always be logged. * error: Critical messages that should never appear. Should always be logged. -## Debug areas -Debug areas split the code into sections that can be enabled/disabled as one. -This is supposed to give finer grained control over what is logged or displayed. - -Debug areas may align with classes, but don't have to, the should be made so that they are useful. - -Areas could be: - -* resource.sync.performance -* resource.sync -* resource.listener -* resource.pipeline -* resource.store -* resource.communication -* client.communication -* client.communication.org.sink.resource.maildir.identifier1 -* client.queryrunner -* client.queryrunner.performance -* common.typeindex +## Debug areas and components +Debug areas and components split the code into sections that can be enabled/disabled as one. This gives finer grained control over what is logged or displayed. + +Debug areas are the static part, that typically represent a class or file, but give no information about which runtime-component is executing the given code. + +Components are the runtime information part that can represent i.e. the resource plugin in the client process or the resource process itself. + +The full debugging area is then assembled as: "Component.Area" + +This can result in identifiers like: + +* $RESOURCE_IDENTIFIER.sync.performance +* $RESOURCE_IDENTIFIER.sync +* $RESOURCE_IDENTIFIER.communication +* $RESOURCE_IDENTIFIER.pipeline +* kube.$RESOURCE_IDENTIFIER.communication +* kube.$RESOURCE_IDENTIFIER.queryrunner +* kube.actions + +## Logging guidelines +* The trace log level should be used for any information that is not continuously required. +* Messages on the Log level should scale. During a sync with 10k messages we don't want 10k messages on the log level, these should go to trace. ## Collected information Additionally to the regular message we want: diff --git a/examples/imapresource/imapresource.cpp b/examples/imapresource/imapresource.cpp index 1dc503d..dde218a 100644 --- a/examples/imapresource/imapresource.cpp +++ b/examples/imapresource/imapresource.cpp @@ -267,8 +267,6 @@ public: commit(); SinkTrace() << "Folder synchronized: " << folder.normalizedPath(); } - - SinkLog() << "Done Synchronizing"; future.setFinished(); }); } -- cgit v1.2.3