mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-22 17:49:43 +01:00
Add logging functions
Named "vlogs" because they're logs for VVVVVV. Also it's a funny name.
This commit is contained in:
parent
ac0644a70a
commit
d9737589de
3 changed files with 70 additions and 0 deletions
|
@ -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
|
||||
)
|
||||
|
|
50
desktop_version/src/Vlogging.c
Normal file
50
desktop_version/src/Vlogging.c
Normal 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;
|
||||
}
|
19
desktop_version/src/Vlogging.h
Normal file
19
desktop_version/src/Vlogging.h
Normal file
|
@ -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 */
|
Loading…
Reference in a new issue