aboutsummaryrefslogtreecommitdiffstats
path: root/debug.c
blob: 271b9fe55aacd86c0daba8322f2d89b220e67cf2 (plain) (blame)
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
#define _BSD_SOURCE
#include <syslog.h>
#include <stdarg.h>
#include <stdio.h>
#include "antispam-plugin.h"

static void _debug(const char *format, va_list ap)
{
#if defined(DEBUG_SYSLOG)
	vsyslog(LOG_DEBUG, format, ap);
#elif defined(DEBUG_STDERR)
	vfprintf(stderr, format, ap);
	fflush(stderr);
#else
#error no logging method
#endif
}

void debug(const char *fmt, ...)
{
	va_list args;

	va_start(args, fmt);
	_debug(fmt, args);
	va_end(args);
}