aggregatelogger.cpp 608 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 30 31
#include "aggregatelogger.hpp"

Aggregatelogger::Aggregatelogger(uid_t ruid):
ILogger(ruid, LOG_DEST_DEV_NULL)
{
}

Aggregatelogger::~Aggregatelogger()
{
}

void Aggregatelogger::log(Log_type type, const string& message, int errnum)
{
	for(int i=0; i<(int)_loggers.size(); i++)
		_loggers[i]->log(type, message, errnum);
}


void Aggregatelogger::add_logger(ILogger* logger)
{
	for(int i=0; i<(int)_loggers.size(); i++)
	{
		if(_loggers[i]->log_destination() == logger->log_destination())
		{
			_loggers[i] = logger;
			return;
		}
	}
	_log_dest |= logger->log_destination();
	_loggers.push_back(logger);
}