aggregatelogger.cpp 1006 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10
/*******************************************************************************
 * Copyright 2019 UChicago Argonne, LLC.
 * (c.f. AUTHORS, LICENSE)
 *
 * This file is part of the Argo containers project.
 * For more info, see https://xgitlab.cels.anl.gov/argo/containers
 *
 * SPDX-License-Identifier: BSD-3-Clause
*******************************************************************************/

Swann Perarnau's avatar
Swann Perarnau committed
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
#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);
}