debug.c revision cac15c3f170b5ec2cc6304c8c0763a78103e1778
1#include <stdio.h> 2#include <stdarg.h> 3 4#include "debug.h" 5#include "options.h" 6#include "output.h" 7 8void 9debug_(int level, char *file, int line, char *func, char *fmt, ...) { 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