defocus-modules/lib/log.c

16 lines
419 B
C

#include <defocus/base.h>
#include <stdio.h>
#include <stdarg.h>
static const char *log_level_names[] = {"VERBOSE", "INFO", "WARN", "ERROR"};
DF_API void df_log_impl(int level, const char *file, int line, const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
fprintf(stderr, "[%s] %s:%d: ", log_level_names[level], file, line);
vfprintf(stderr, fmt, ap);
fprintf(stderr, "\n");
va_end(ap);
}