aggregatelogger.hpp 1.16 KB
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
#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