Add logging functions

Named "vlogs" because they're logs for VVVVVV. Also it's a funny name.
This commit is contained in:
Misa
2021-02-23 00:54:45 -08:00
committed by Misa Elizabeth Kai
parent ac0644a70a
commit d9737589de
3 changed files with 70 additions and 0 deletions

View File

@@ -0,0 +1,50 @@
#include <stdarg.h>
#include <stdio.h>
int vlog_info(const char* text, ...)
{
va_list list;
int retval;
printf("[INFO] ");
va_start(list, text);
retval = vprintf(text, list);
va_end(list);
putchar('\n');
return retval;
}
int vlog_warn(const char* text, ...)
{
va_list list;
int retval;
fprintf(stderr, "[WARN] ");
va_start(list, text);
retval = vfprintf(stderr, text, list);
va_end(list);
fputc('\n', stderr);
return retval;
}
int vlog_error(const char* text, ...)
{
va_list list;
int retval;
fprintf(stderr, "[ERROR] ");
va_start(list, text);
retval = vfprintf(stderr, text, list);
va_end(list);
fputc('\n', stderr);
return retval;
}