logger.h 643 Bytes
#ifndef __LOGGER_H__
#define __LOGGER_H__

#include "cclass.h"


#define LOGGER_EMERG	0
#define LOGGER_ALERT	1
#define LOGGER_CRIT		2
#define LOGGER_ERR		3
#define LOGGER_WARNING	4
#define LOGGER_NOTICE	5
#define LOGGER_INFO		6
#define LOGGER_DEBUG	7

#define MAX_LOG_FNCTS	10


typedef void (*logger_logfnct)(int level, const char * msg);


CLASS(LOGGER) {
	logger_logfnct logfncts[MAX_LOG_FNCTS];
	unsigned int logfncts_count;
};

void logger_log(LOGGER this, int level, const char * msg, ...)
	__attribute__((format (printf, 3, 4)));

void logger_add(LOGGER this, logger_logfnct logfunc);

#endif /* __LOGGER_H__ */

// vim: set ts=4 sw=4: