Ejemplo n.º 1
0
// Print out if logging level is met. Should always be called from a macro
void lbLog::out(const char* fileTrace, int lineTrace, std::string levelTag, int sentLevel, std::string msg) {

	std::string toLog = "["+_getDateTime(true)+"]["+levelTag+"]:"+fileTrace+":"+std::to_string(lineTrace)+": "+msg;

	// Quit
	if (sentLevel <= _quitLevel)
	{
		std::cout << toLog << std::endl;
		_writeToFile(toLog);

		endLog();
		std::exit(1);
	}

	// Outputting to screen
	if (sentLevel <= _logLevel)
	{
		std::cout << toLog << std::endl;
	}

	// Outputting to file
	if (sentLevel <= _fileLogLevel)
	{
		_writeToFile(toLog);
	}
}
Ejemplo n.º 2
0
void CPersistentDataContainer::writeData(const char* dataName,const std::string& value,bool toFile)
{
	_writeData(dataName,value);
	if (toFile)
	{
		std::vector<std::string> _dataNamesAux;
		std::vector<std::string> _dataValuesAux;
		_readFromFile(_dataNamesAux,_dataValuesAux);
		_dataNames.swap(_dataNamesAux);
		_dataValues.swap(_dataValuesAux);
		_writeData(dataName,value);
		_dataNames.swap(_dataNamesAux);
		_dataValues.swap(_dataValuesAux);
		_writeToFile(_dataNamesAux,_dataValuesAux);
	}
}