diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-08-13 22:01:31 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-08-13 22:01:31 +0200 |
commit | 5807b5dc09e5532532753ba2bb48f014d20ad5a0 (patch) | |
tree | 3f60a89f5a131c0bb328241fd83b0df474c254a9 /common/log.h | |
parent | b6d5d206de4d02149c6530236154283bf834087a (diff) | |
download | sink-5807b5dc09e5532532753ba2bb48f014d20ad5a0.tar.gz sink-5807b5dc09e5532532753ba2bb48f014d20ad5a0.zip |
A way to set the debuglevel.
Unittests can set the level themselves (so i.e. benchmarks don't print
a shitload of messages), while in normal operation we can set it from
the environment. There's no override currently, but first things first.
Diffstat (limited to 'common/log.h')
-rw-r--r-- | common/log.h | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/common/log.h b/common/log.h index ee92f46..9db9e8e 100644 --- a/common/log.h +++ b/common/log.h | |||
@@ -2,6 +2,9 @@ | |||
2 | 2 | ||
3 | #include <QDebug> | 3 | #include <QDebug> |
4 | 4 | ||
5 | namespace Akonadi2 { | ||
6 | namespace Log { | ||
7 | |||
5 | enum DebugLevel { | 8 | enum DebugLevel { |
6 | Trace, | 9 | Trace, |
7 | Log, | 10 | Log, |
@@ -9,10 +12,15 @@ enum DebugLevel { | |||
9 | Error | 12 | Error |
10 | }; | 13 | }; |
11 | 14 | ||
15 | void setDebugOutputLevel(DebugLevel); | ||
16 | |||
12 | QDebug debugStream(DebugLevel debugLevel, int line, const char* file, const char* function, const char* debugArea = 0); | 17 | QDebug debugStream(DebugLevel debugLevel, int line, const char* file, const char* function, const char* debugArea = 0); |
13 | 18 | ||
14 | #define Trace() debugStream(DebugLevel::Trace, __LINE__, __FILE__, Q_FUNC_INFO) | 19 | } |
15 | #define Log() debugStream(DebugLevel::Log, __LINE__, __FILE__, Q_FUNC_INFO) | 20 | } |
16 | #define Warning() debugStream(DebugLevel::Warning, __LINE__, __FILE__, Q_FUNC_INFO) | 21 | |
22 | #define Trace() Akonadi2::Log::debugStream(Akonadi2::Log::DebugLevel::Trace, __LINE__, __FILE__, Q_FUNC_INFO) | ||
23 | #define Log() Akonadi2::Log::debugStream(Akonadi2::Log::DebugLevel::Log, __LINE__, __FILE__, Q_FUNC_INFO) | ||
24 | #define Warning() Akonadi2::Log::debugStream(Akonadi2::Log::DebugLevel::Warning, __LINE__, __FILE__, Q_FUNC_INFO) | ||
17 | //FIXME Error clashes with Storage::Error and MessageQueue::Error | 25 | //FIXME Error clashes with Storage::Error and MessageQueue::Error |
18 | #define ErrorMsg() debugStream(DebugLevel::Error, __LINE__, __FILE__, Q_FUNC_INFO) | 26 | #define ErrorMsg() Akonadi2::Log::debugStream(Akonadi2::Log::DebugLevel::Error, __LINE__, __FILE__, Q_FUNC_INFO) |