mirror of
https://github.com/status-im/snorenotify.git
synced 2025-02-20 12:08:21 +00:00
added possebility to set debug level
This commit is contained in:
parent
f1dab6aa55
commit
cdacc74d88
@ -21,6 +21,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
using namespace Snore;
|
using namespace Snore;
|
||||||
|
int Log::s_debugLevel = qgetenv("SNORE_DEBUG_LVL").toInt();
|
||||||
|
|
||||||
Log::Log(int lvl):
|
Log::Log(int lvl):
|
||||||
QDebug(&m_msg),
|
QDebug(&m_msg),
|
||||||
@ -29,14 +30,14 @@ Log::Log(int lvl):
|
|||||||
}
|
}
|
||||||
|
|
||||||
Log::~Log()
|
Log::~Log()
|
||||||
{
|
|
||||||
log();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Log::log()
|
|
||||||
{
|
{
|
||||||
if(debugLvl() >= m_lvl)
|
if(debugLvl() >= m_lvl)
|
||||||
{
|
{
|
||||||
std::wcout << m_msg.toUtf8().constData() << std::endl;
|
std::wcout << m_msg.toUtf8().constData() << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Log::setDebugLvl(int i)
|
||||||
|
{
|
||||||
|
s_debugLevel = i;
|
||||||
|
}
|
||||||
|
@ -33,15 +33,15 @@ public:
|
|||||||
|
|
||||||
static inline int debugLvl()
|
static inline int debugLvl()
|
||||||
{
|
{
|
||||||
static int lvl = qgetenv("SNORE_DEBUG_LVL").toInt();
|
return s_debugLevel;
|
||||||
return lvl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static setDebugLvl(int i);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
static int s_debugLevel;
|
||||||
int m_lvl;
|
int m_lvl;
|
||||||
QString m_msg;
|
QString m_msg;
|
||||||
|
|
||||||
void log();
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user