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