aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKikooDX <kikoodx@paranoici.org>2022-04-12 11:48:42 +0200
committerKikooDX <kikoodx@paranoici.org>2022-04-12 11:48:42 +0200
commitcefa79506f64eebdba4a0b427a3083f89533d905 (patch)
tree4126fe5e185939a6c2999609910df218109cc8a7
parentf2911ceebdef567e62f18b7037e85566ab10b4c2 (diff)
downloadlzy-cefa79506f64eebdba4a0b427a3083f89533d905.tar.gz
LZY_Log takes variable argument list
-rw-r--r--inc/lzy.h17
1 files changed, 12 insertions, 5 deletions
diff --git a/inc/lzy.h b/inc/lzy.h
index fedc82f..d64bef5 100644
--- a/inc/lzy.h
+++ b/inc/lzy.h
@@ -108,7 +108,7 @@ int LZY_PollEvent(LZY_Event *);
void LZY_CycleEvents(void);
int LZY_KeyDown(unsigned int key);
int LZY_ShouldQuit(void);
-void LZY_Log(const char *msg);
+void LZY_Log(const char *fmt, ...);
const char *LZY_GetError(void);
#ifdef __cplusplus
@@ -469,8 +469,8 @@ int LZY_ShouldQuit(void) {
return should_quit;
}
-void LZY_Log(const char *msg) {
- LZY_UNUSED(msg);
+void LZY_Log(const char *fmt, ...) {
+ LZY_UNUSED(fmt);
}
const char *LZY_GetError(void) {
@@ -1050,8 +1050,15 @@ int LZY_ShouldQuit(void) {
return should_quit;
}
-void LZY_Log(const char *msg) {
- SDL_Log("%s", msg);
+void LZY_Log(const char *fmt, ...) {
+ char buf[2048] = {0};
+ va_list args;
+
+ va_start(args, fmt);
+ vsnprintf(buf, sizeof(buf) - 1, fmt, args);
+ va_end(args);
+
+ SDL_Log("%s", buf);
}
const char *LZY_GetError(void) {