Skip to content
Snippets Groups Projects
Logger.cpp 2.54 KiB
Newer Older
#include "../inc/Logger.h"
#include <Poco/Logger.h>
	Logger::Logger(const std::string& name): _log(Poco::Logger::get(name))
	{  
		_name = name;
	}

	void Logger::fatal(const std::string& msg)
	{
Matt Clarke's avatar
Matt Clarke committed
		catch (std::exception& e)
		{
			//failures in logging are not allowed to throw exceptions out of the logging class
			std::cerr << e.what();
		}
	}
		
	void Logger::critical(const std::string& msg)
	{
Matt Clarke's avatar
Matt Clarke committed
		catch (std::exception& e)
		{
			//failures in logging are not allowed to throw exceptions out of the logging class
			std::cerr << e.what();
		}
	}

	void Logger::error(const std::string& msg)
	{
Matt Clarke's avatar
Matt Clarke committed
		catch (std::exception& e)
		{
			//failures in logging are not allowed to throw exceptions out of the logging class
			std::cerr << e.what();
		}
		
	}

	void Logger::warning(const std::string& msg)
	{
Matt Clarke's avatar
Matt Clarke committed
		catch (std::exception& e)
		{
			//failures in logging are not allowed to throw exceptions out of the logging class
			std::cerr << e.what();
		}
	}

	void Logger::information(const std::string& msg)
	{
Matt Clarke's avatar
Matt Clarke committed
		catch (std::exception& e)
		{
			//failures in logging are not allowed to throw exceptions out of the logging class
			std::cerr << e.what();
		}
	}

	void Logger::debug(const std::string& msg)
	{
Matt Clarke's avatar
Matt Clarke committed
		catch (std::exception& e)
		{
			//failures in logging are not allowed to throw exceptions out of the logging class
			std::cerr << e.what();
		}
	void Logger::dump(const std::string& msg, const void* buffer, std::size_t length)
Matt Clarke's avatar
Matt Clarke committed
		catch (std::exception& e)
		{
			//failures in logging are not allowed to throw exceptions out of the logging class
			std::cerr << e.what();
		}

	bool Logger::is(int level) const
	{
Nick Draper's avatar
Nick Draper committed
		bool retVal = false;
Nick Draper's avatar
Nick Draper committed
			retVal = _log.is(level);
Matt Clarke's avatar
Matt Clarke committed
		catch (std::exception& e)
		{
			//failures in logging are not allowed to throw exceptions out of the logging class
			std::cerr << e.what();
		}
Nick Draper's avatar
Nick Draper committed
		return retVal;
Matt Clarke's avatar
Matt Clarke committed
		catch (std::exception& e)
		{
			//failures in logging are not allowed to throw exceptions out of the logging class
			std::cerr << e.what();
		}
	}

	Logger& Logger::get(const std::string& name)
	{
		Logger* pLogger = new Logger(name);
		return *pLogger;
	}