debug.c revision 3219f320604810532a4938dda8f9dfadb0e840f3
1#include <stdio.h>
2#include <stdarg.h>
3
4#include "debug.h"
5#include "options.h"
6#include "output.h"
7
8void debug_(int level, char *file, int line, const char *func, char *fmt, ...)
9{
10	char buf[1024];
11	va_list args;
12
13	if (opt_d < level) {
14		return;
15	}
16	va_start(args, fmt);
17	vsnprintf(buf, 1024, fmt, args);
18	va_end(args);
19
20	output_line(NULL, "DEBUG: %s:%d: %s(): %s", file, line, func, buf);
21}
22