/**
* Triangles
* Copyright (C) 2016 POSITIVE MENTAL ATTITUDE
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#include
#include "Utility.hpp"
#ifdef TRIANGLES_DEBUG
int Echo::_loglevel = 4;
#else
int Echo::_loglevel = 1;
#endif
bool Echo::printType(int order)
{
switch(order)
{
case Error:
if(_loglevel >= 1)
{
std::cerr << "Error: ";
return true;
}
return false;
case Info:
if(_loglevel >= 2)
{
std::cout << "PSA: ";
return true;
}
return false;
case Load:
if(_loglevel >= 3)
{
std::cout << "Loaded ";
return true;
}
return false;
case Debug:
if(_loglevel >= 4)
{
std::cout << "Debug: ";
return true;
}
return false;
case Empty: default:
if(_loglevel >= 1)
return true;
return false;
}
}
void Echo::helper(bool err, std::wstring out)
{
if(err)
std::wcerr << out;
else
std::wcout << out;
}
void Echo::out(std::string debug)
{
if(!printType(Debug))
std::printf("%s", &debug[0]);
}
void Echo::out(float debug)
{
if(printType(Debug))
std::printf("%f\n", debug);
}