diff --git a/desktop_version/CMakeLists.txt b/desktop_version/CMakeLists.txt index 41534cae..a5b0d130 100644 --- a/desktop_version/CMakeLists.txt +++ b/desktop_version/CMakeLists.txt @@ -112,6 +112,7 @@ set(VVV_SRC src/GlitchrunnerMode.c src/Network.c src/ThirdPartyDeps.c + src/Vlogging.c src/Xoshiro.c ../third_party/physfs/extras/physfsrwops.c ) diff --git a/desktop_version/src/Vlogging.c b/desktop_version/src/Vlogging.c new file mode 100644 index 00000000..ed7588be --- /dev/null +++ b/desktop_version/src/Vlogging.c @@ -0,0 +1,50 @@ +#include +#include + +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; +} diff --git a/desktop_version/src/Vlogging.h b/desktop_version/src/Vlogging.h new file mode 100644 index 00000000..3189fadd --- /dev/null +++ b/desktop_version/src/Vlogging.h @@ -0,0 +1,19 @@ +#ifndef VLOGGING_H +#define VLOGGING_H + +#ifdef __cplusplus +extern "C" +{ +#endif + +int vlog_info(const char* text, ...); + +int vlog_warn(const char* text, ...); + +int vlog_error(const char* text, ...); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* VLOGGING_H */