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. --- tests/clientapitest.cpp | 10 ++++++---- tests/mailsynctest.cpp | 4 +++- tests/mailtest.cpp | 6 ++++-- tests/messagequeuetest.cpp | 4 +++- 4 files changed, 16 insertions(+), 8 deletions(-) (limited to 'tests') diff --git a/tests/clientapitest.cpp b/tests/clientapitest.cpp index 8c5866d..ec74cbd 100644 --- a/tests/clientapitest.cpp +++ b/tests/clientapitest.cpp @@ -9,6 +9,8 @@ #include "resultprovider.h" #include "facadefactory.h" +SINK_DEBUG_AREA("clientapitest") + template class TestDummyResourceFacade : public Sink::StoreFacade { @@ -44,7 +46,7 @@ public: { auto resultProvider = new Sink::ResultProvider(); resultProvider->onDone([resultProvider]() { - Trace() << "Result provider is done"; + SinkTrace() << "Result provider is done"; delete resultProvider; }); // We have to do it this way, otherwise we're not setting the fetcher right @@ -52,11 +54,11 @@ public: resultProvider->setFetcher([query, resultProvider, this](const typename T::Ptr &parent) { if (parent) { - Trace() << "Running the fetcher " << parent->identifier(); + SinkTrace() << "Running the fetcher " << parent->identifier(); } else { - Trace() << "Running the fetcher."; + SinkTrace() << "Running the fetcher."; } - Trace() << "-------------------------."; + SinkTrace() << "-------------------------."; for (const auto &res : results) { qDebug() << "Parent filter " << query.propertyFilter.value("parent").value.toByteArray() << res->identifier() << res->getProperty("parent").toByteArray(); auto parentProperty = res->getProperty("parent").toByteArray(); diff --git a/tests/mailsynctest.cpp b/tests/mailsynctest.cpp index 953adbf..4401f27 100644 --- a/tests/mailsynctest.cpp +++ b/tests/mailsynctest.cpp @@ -31,6 +31,8 @@ using namespace Sink; using namespace Sink::ApplicationDomain; +SINK_DEBUG_AREA("mailsynctest") + void MailSyncTest::initTestCase() { Test::initTest(); @@ -73,7 +75,7 @@ void MailSyncTest::testListFolders() for (const auto &folder : folders) { names << folder->getName(); } - Trace() << "base folder: " << names; + SinkTrace() << "base folder: " << names; baseCount = folders.size(); }); VERIFYEXEC(job); diff --git a/tests/mailtest.cpp b/tests/mailtest.cpp index 8031cf1..0537175 100644 --- a/tests/mailtest.cpp +++ b/tests/mailtest.cpp @@ -31,6 +31,8 @@ using namespace Sink; using namespace Sink::ApplicationDomain; +SINK_DEBUG_AREA("mailtest") + void MailTest::initTestCase() { Test::initTest(); @@ -251,7 +253,7 @@ void MailTest::testMoveMail() auto mail = *mails.first(); modifiedMail = mail; QCOMPARE(mail.getFolder(), folder.identifier()); - Warning() << "path: " << mail.getMimeMessagePath(); + SinkWarning() << "path: " << mail.getMimeMessagePath(); QVERIFY(QFile(mail.getMimeMessagePath()).exists()); }); VERIFYEXEC(job); @@ -270,7 +272,7 @@ void MailTest::testMoveMail() auto mail = *mails.first(); QCOMPARE(mail.getFolder(), folder1.identifier()); QVERIFY(QFile(mail.getMimeMessagePath()).exists()); - Trace() << "Mime message path: " << mail.getMimeMessagePath(); + SinkTrace() << "Mime message path: " << mail.getMimeMessagePath(); }); VERIFYEXEC(job); } diff --git a/tests/messagequeuetest.cpp b/tests/messagequeuetest.cpp index 484ff86..a8d0d4d 100644 --- a/tests/messagequeuetest.cpp +++ b/tests/messagequeuetest.cpp @@ -8,6 +8,8 @@ #include "messagequeue.h" #include "log.h" +SINK_DEBUG_AREA("messagequeuetest") + /** * Test of the messagequeue implementation. */ @@ -80,7 +82,7 @@ private slots: } while (!queue.isEmpty()) { - Log() << "start"; + SinkLog() << "start"; const auto expected = values.dequeue(); bool gotValue = false; bool gotError = false; -- cgit v1.2.3