log.c 526 Bytes
#define _ISOC99_SOURCE

#include <stdio.h>
#include <string.h>

#include "logger.h"

void
logger_log(LOGGER this, int level, const char * message, ...) {
	va_list          args;
	char             buffer[1025];
	logger_logfnct * logfnct;

	int maxBuf = sizeof(buffer)/sizeof(buffer[0]);

	memset(buffer, 0, maxBuf);

	va_start(args, message);
	vsnprintf(buffer, 1024, message, args);
	va_end(args);

	logfnct = this->logfncts;

	while (NULL != *logfnct) {
		(*logfnct)(level, buffer);
		logfnct++;
	}
}

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