2013-12-22 14:04:33 +00:00
|
|
|
#include "Logs.h"
|
2015-08-12 22:33:16 +00:00
|
|
|
|
|
|
|
static std::ostream NULL_STREAM(0);
|
|
|
|
static bool enabled = true;
|
|
|
|
|
|
|
|
std::ostream &Logs::debug()
|
|
|
|
{
|
|
|
|
#ifdef NDEBUG
|
|
|
|
return NULL_STREAM;
|
|
|
|
#else
|
|
|
|
if (enabled)
|
|
|
|
{
|
|
|
|
std::cout << "DEBUG - ";
|
|
|
|
return std::cout;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return NULL_STREAM;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
std::ostream &Logs::warning()
|
|
|
|
{
|
|
|
|
if (enabled)
|
|
|
|
{
|
|
|
|
std::cerr << "WARN - ";
|
|
|
|
return std::cerr;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return NULL_STREAM;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
std::ostream &Logs::error()
|
|
|
|
{
|
|
|
|
if (enabled)
|
|
|
|
{
|
|
|
|
std::cerr << "ERROR - ";
|
|
|
|
return std::cerr;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return NULL_STREAM;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Logs::disable()
|
|
|
|
{
|
|
|
|
enabled = false;
|
|
|
|
}
|