/***************************************************************************
*   Copyright (C) 2004 by Denis A. Birukov aka Messenger of death         *
*   riper@fromru.com                                                      *
*                                                                         *
*   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; either version 2 of the License, or     *
*   (at your option) any later version.                                   *
*                                                                         *
*   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, write to the                         *
*   Free Software Foundation, Inc.,                                       *
*   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
***************************************************************************/
#ifndef ME_N_LOGME_C_LOG_INTERFACE_H
#define ME_N_LOGME_C_LOG_INTERFACE_H
#include <me_defines.h>
#include <string>
#include <iostream>
namespace ME_n_Log
{

	/**
	Интерфейсный класс для всех логов. Описывает набор функций, которые должны обеспечивать все классы для работы с логами.
	Если для работы лога нужны какиелибо настройки, то они должны обеспечиваться конструктором.
	 
	@author Denis A. Birukov aka Messenger of death 
	*/
	class ME_c_Log_Interface
	{
		public:
			DECLSPEC virtual ~ME_c_Log_Interface()
			{}
			/** Данная функция должна выполнять вывод данных в лог.*/
			DECLSPEC virtual void _log( std::string arg1, Uint8 pr ) = 0;
			DECLSPEC virtual std::ostream& _log() = 0;
			DECLSPEC virtual std::ostream& _log( Uint8 pr ) = 0;
			/** Данная функция производит смену приоритета для лога.*/
			DECLSPEC virtual void _set_priority( Uint8 arg1 ) = 0;
			DECLSPEC virtual ME_c_Log_Interface& operator() ( Uint8 pr )
			{
				_cur_priority_=pr;
				return *this;
			}
			template <typename T> ME_c_Log_Interface& operator<<( T _val )
			{
				if (_cur_priority_>_priority_) _log() << _val;
				return *this;
			}
			DECLSPEC ME_c_Log_Interface& operator<<( std::ostream& ( *op ) ( std::ostream& ) )
			{
				if ( _cur_priority_>_priority_ ) _log() << *op;
				return *this;
			}
		protected:
			Uint8 _priority_;
			Uint8 _cur_priority_;
	};

	enum ME_LOG_LEVEL
	{
	    ME_LOG_NONE = 255,
	    ME_LOG_FATAL = 230,
	    ME_LOG_ERRORS = 210,
	    ME_LOG_WARNINGS = 190,
	    ME_LOG_ALL = 0
	};
}

#endif
