aggregatelogger.hpp 785 Bytes
Newer Older
Swann Perarnau's avatar
Swann Perarnau committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
#ifndef __AGGREGATELOGGER_HPP__
#define __AGGREGATELOGGER_HPP__
#include "ilogger.hpp"
#include "syslogger.hpp"
#include "stderrlogger.hpp"
#include "filelogger.hpp"

class Aggregatelogger: public ILogger
{

	Log_dest _log_dest;
	vector<ILogger*> _loggers;
		
	public:
		Aggregatelogger(uid_t ruid);
		~Aggregatelogger();
		virtual void log(Log_type type, const string& message, int errnum = 0);
		virtual inline Log_dest log_destination() const {return _log_dest;}

		/*A maximum of 1 instance of each type of logger. If a type of logger
		 * is added that already existed, it is overwritten.
		 * The added loggers must be deleted outside thsi object*/
		void add_logger(ILogger* logger);

		inline void clear_loggers() {_loggers.clear(); _log_dest = LOG_DEST_DEV_NULL;}

};

#endif