Debug.cpp

From Giona


/****************************************************************************
 *This class implements the debugging tool.
 * --------------------------------------------------------------------------
 *Author: Rosario Marino
 ***************************************************************************/

#include "Debug.h"


/*
 * 	Sets the debug mode ON
 */
void Debug::setDebugOn()
{
	std::cout << "DEBUG MODE IS ON" <<std::endl;
	debug_on=true;
}

/*
 * 	Sets the debug error mode ON
 */
void Debug::setDebugErrorOn()
{
	std::cout << "DEBUG ERROR MODE IS ON" <<std::endl;
	debug_error_on=true;
}


/*
 * 	Sets the debug mode OFF
 */
void Debug::setDebugOff()
{
	debug_on=false;
}

/*
 * 	Sets the debug error mode OFF
 */
void Debug::setDebugErrorOff()
{
	debug_error_on=false;
}


/*
 * 	Debug message on console
 */
void Debug::debug(STRING txt)
{
	if(debug_on)
	{
		std::cout << "dbg: " << time(0) << " -> " << txt << std::endl;
	}
}


/*
 * 	Debug error message on console
 */
void Debug::debugError(STRING function, STRING error, STRING msg)
{
	if(debug_error_on)
	{
		std::cout << "ERROR: " << time(0) << " ->  in function " << function << std::endl;
		std::cout << "Error signaled: " << error << std::endl;
		std::cout << "- : " << msg << std::endl;
	}
}

BACK

Personal tools