diff options
Diffstat (limited to 'src/log.c')
-rw-r--r-- | src/log.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/log.c b/src/log.c new file mode 100644 index 0000000..4ce6ae8 --- /dev/null +++ b/src/log.c @@ -0,0 +1,24 @@ +#include "log.h" + +#include <stdio.h> +#include <stdarg.h> +#include <stdlib.h> + +static enum imv_log_level g_log_level = IMV_WARNING; + +void imv_log_set_level(enum imv_log_level level) +{ + g_log_level = level; +} + +void imv_log(enum imv_log_level level, const char *fmt, ...) +{ + if (level > g_log_level) { + return; + } + + va_list args; + va_start(args, fmt); + vfprintf(stderr, fmt, args); + va_end(args); +} |