blob: 9ba4ec40d30195e2a18f042f99030ab8dd1fa76d [file] [log] [blame]
#include "debug.h"
#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
static bool debug_enabled = false;
static FILE *debug_stream = NULL;
void
debug_enable(
FILE *stream
)
{
debug_stream = stream;
debug_enabled = true;
}
void
__attribute__((format(printf, 1, 2)))
debug_log(
const char *format, ...
)
{
va_list ap;
va_start(ap, format);
if (debug_enabled) {
fprintf(debug_stream, "LAVA> ");
vfprintf(debug_stream, format, ap);
}
va_end(ap);
}