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/mailpreprocessor.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'common/mailpreprocessor.cpp') diff --git a/common/mailpreprocessor.cpp b/common/mailpreprocessor.cpp index c38035e..2863ad4 100644 --- a/common/mailpreprocessor.cpp +++ b/common/mailpreprocessor.cpp @@ -29,6 +29,8 @@ using namespace Sink; +SINK_DEBUG_AREA("mailpreprocessor") + QString MailPropertyExtractor::getFilePathFromMimeMessagePath(const QString &s) const { return s; @@ -38,23 +40,23 @@ void MailPropertyExtractor::updatedIndexedProperties(Sink::ApplicationDomain::Ma { const auto mimeMessagePath = getFilePathFromMimeMessagePath(mail.getMimeMessagePath()); if (mimeMessagePath.isNull()) { - Trace() << "No mime message"; + SinkTrace() << "No mime message"; return; } - Trace() << "Updating indexed properties " << mimeMessagePath; + SinkTrace() << "Updating indexed properties " << mimeMessagePath; QFile f(mimeMessagePath); if (!f.open(QIODevice::ReadOnly)) { - Warning() << "Failed to open the file: " << mimeMessagePath; + SinkWarning() << "Failed to open the file: " << mimeMessagePath; return; } if (!f.size()) { - Warning() << "The file is empty."; + SinkWarning() << "The file is empty."; return; } const auto mappedSize = qMin((qint64)8000, f.size()); auto mapped = f.map(0, mappedSize); if (!mapped) { - Warning() << "Failed to map the file: " << f.errorString(); + SinkWarning() << "Failed to map the file: " << f.errorString(); return; } @@ -89,15 +91,15 @@ QString MimeMessageMover::moveMessage(const QString &oldPath, const Sink::Applic const auto filePath = directory + "/" + mail.identifier(); if (oldPath != filePath) { if (!QDir().mkpath(directory)) { - Warning() << "Failed to create the directory: " << directory; + SinkWarning() << "Failed to create the directory: " << directory; } QFile::remove(filePath); QFile origFile(oldPath); if (!origFile.open(QIODevice::ReadWrite)) { - Warning() << "Failed to open the original file with write rights: " << origFile.errorString(); + SinkWarning() << "Failed to open the original file with write rights: " << origFile.errorString(); } if (!origFile.rename(filePath)) { - Warning() << "Failed to move the file from: " << oldPath << " to " << filePath << ". " << origFile.errorString(); + SinkWarning() << "Failed to move the file from: " << oldPath << " to " << filePath << ". " << origFile.errorString(); } origFile.close(); return filePath; -- cgit v1.2.3