diff options
-rw-r--r-- | akonadish/state.cpp | 14 | ||||
-rw-r--r-- | akonadish/state.h | 3 |
2 files changed, 17 insertions, 0 deletions
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 @@ | |||
24 | #include <QEventLoop> | 24 | #include <QEventLoop> |
25 | #include <QTextStream> | 25 | #include <QTextStream> |
26 | 26 | ||
27 | #include "common/log.h" | ||
28 | |||
27 | static bool s_hasEventLoop = false; | 29 | static bool s_hasEventLoop = false; |
28 | 30 | ||
29 | class State::Private | 31 | class State::Private |
@@ -122,4 +124,16 @@ bool State::commandTiming() const | |||
122 | return d->timing; | 124 | return d->timing; |
123 | } | 125 | } |
124 | 126 | ||
127 | void State::setLoggingLevel(const QString &level) const | ||
128 | { | ||
129 | Akonadi2::Log::setDebugOutputLevel(Akonadi2::Log::debugLevelFromName(level.toLatin1())); | ||
130 | } | ||
131 | |||
132 | QString State::loggingLevel() const | ||
133 | { | ||
134 | // do not turn this into a single line return: that core dumps due to allocation of | ||
135 | // the byte array in Akonadi2::Log | ||
136 | QByteArray rv = Akonadi2::Log::debugLevelName(Akonadi2::Log::debugOutputLevel()); | ||
137 | return rv.toLower(); | ||
138 | } | ||
125 | 139 | ||
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: | |||
39 | int commandStarted() const; | 39 | int commandStarted() const; |
40 | void commandFinished(int returnCode = 0) const; | 40 | void commandFinished(int returnCode = 0) const; |
41 | 41 | ||
42 | void setLoggingLevel(const QString &level) const; | ||
43 | QString loggingLevel() const; | ||
44 | |||
42 | static void setHasEventLoop(bool evented); | 45 | static void setHasEventLoop(bool evented); |
43 | 46 | ||
44 | private: | 47 | private: |