| Juan Cespedes | cac15c3 | 2003-01-31 18:58:58 +0100 | [diff] [blame] | 1 | #include <stdio.h> |
| 2 | #include <stdarg.h> |
| 3 | |
| 4 | #include "debug.h" |
| 5 | #include "options.h" |
| 6 | #include "output.h" |
| 7 | |
| Ian Wienand | 3219f32 | 2006-02-16 06:00:00 +0100 | [diff] [blame^] | 8 | void debug_(int level, char *file, int line, const char *func, char *fmt, ...) |
| 9 | { |
| Juan Cespedes | cac15c3 | 2003-01-31 18:58:58 +0100 | [diff] [blame] | 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 | } |