some more debug changes

This commit is contained in:
Patrick von Reth 2014-01-20 09:23:38 +01:00
parent cdacc74d88
commit c1235f0432
5 changed files with 28 additions and 6 deletions

View File

@ -94,7 +94,7 @@ QDebug operator<< ( QDebug debug, const Snore::Application &app )
{ {
debug << a << ", "; debug << a << ", ";
} }
debug << app.constHints() << ")" ; debug << ")" ;
} }
else else
{ {

View File

@ -53,7 +53,24 @@ bool Hint::contains(const QString &key) const
QDebug operator<<( QDebug debug, const Snore::Hint &hint ) QDebug operator<<( QDebug debug, const Snore::Hint &hint )
{ {
debug << "Snore::Hint(" << hint.m_data << ", " << hint.m_privateData << ")" ; debug << "Snore::Hint(";
for(QVariantHash::const_iterator it = hint.m_data.constBegin();it != hint.m_data.constEnd();++it)
{
if(it != hint.m_data.constBegin())
{
debug << ", ";
}
debug << "(" << it.key() << ", " << it.value();
}
for(QHash< QPair<const void*, QString>, QVariant>::const_iterator it = hint.m_privateData.constBegin();it != hint.m_privateData.constEnd();++it)
{
if(it != hint.m_privateData.constBegin())
{
debug << ", ";
}
debug << "(" << it.key() << ", " << it.value();
}
debug << ")" ;
return debug.maybeSpace(); return debug.maybeSpace();
} }

View File

@ -21,7 +21,7 @@
#include <iostream> #include <iostream>
using namespace Snore; using namespace Snore;
int Log::s_debugLevel = qgetenv("SNORE_DEBUG_LVL").toInt(); int Log::s_debugLevel = -1;
Log::Log(int lvl): Log::Log(int lvl):
QDebug(&m_msg), QDebug(&m_msg),
@ -37,7 +37,7 @@ Log::~Log()
} }
} }
Log::setDebugLvl(int i) void Log::setDebugLvl(int i)
{ {
s_debugLevel = i; s_debugLevel = i;
} }

View File

@ -33,10 +33,14 @@ public:
static inline int debugLvl() static inline int debugLvl()
{ {
if(s_debugLevel == -1)
{
s_debugLevel = qgetenv("SNORE_DEBUG_LVL").toInt();
}
return s_debugLevel; return s_debugLevel;
} }
static setDebugLvl(int i); static void setDebugLvl(int i);
private: private:
static int s_debugLevel; static int s_debugLevel;
@ -49,4 +53,5 @@ private:
#define SNORE_DEBUG 3 #define SNORE_DEBUG 3
#define SNORE_INFO 2 #define SNORE_INFO 2
#define SNORE_WARNING 1 #define SNORE_WARNING 1
#define SNORE_LOG 0
#endif // LOG_H #endif // LOG_H

View File

@ -99,7 +99,7 @@ inline QDebug operator<< ( QDebug debug, const Snore::Notification &noti )
{ {
if(noti.isValid()) if(noti.isValid())
{ {
debug << "Snore::Notification(" << noti.title() << ", " << noti.text() << "," << noti.id() << ", " << noti.constHints() << ")" ; debug << "Snore::Notification(" << noti.title() << ", " << noti.text() << "," << noti.id() << ")" ;
} }
else else
{ {