From 2760d5944802f24321ed98083e9f15a484197f7b Mon Sep 17 00:00:00 2001 From: Aaron Seigo Date: Sun, 10 Jan 2016 11:19:09 +0100 Subject: add logging level management to State --- akonadish/state.cpp | 14 ++++++++++++++ akonadish/state.h | 3 +++ 2 files changed, 17 insertions(+) (limited to 'akonadish') diff --git a/akonadish/state.cpp b/akonadish/state.cpp index f3f5975..dbd5952 100644 --- a/akonadish/state.cpp +++ b/akonadish/state.cpp @@ -24,6 +24,8 @@ #include #include +#include "common/log.h" + static bool s_hasEventLoop = false; class State::Private @@ -122,4 +124,16 @@ bool State::commandTiming() const return d->timing; } +void State::setLoggingLevel(const QString &level) const +{ + Akonadi2::Log::setDebugOutputLevel(Akonadi2::Log::debugLevelFromName(level.toLatin1())); +} + +QString State::loggingLevel() const +{ + // do not turn this into a single line return: that core dumps due to allocation of + // the byte array in Akonadi2::Log + QByteArray rv = Akonadi2::Log::debugLevelName(Akonadi2::Log::debugOutputLevel()); + return rv.toLower(); +} diff --git a/akonadish/state.h b/akonadish/state.h index 9c1ab6f..543b063 100644 --- a/akonadish/state.h +++ b/akonadish/state.h @@ -39,6 +39,9 @@ public: int commandStarted() const; void commandFinished(int returnCode = 0) const; + void setLoggingLevel(const QString &level) const; + QString loggingLevel() const; + static void setHasEventLoop(bool evented); private: -- cgit v1.2.3