diff options
author | KikooDX <kikoodx@paranoici.org> | 2022-04-12 11:48:42 +0200 |
---|---|---|
committer | KikooDX <kikoodx@paranoici.org> | 2022-04-12 11:48:42 +0200 |
commit | cefa79506f64eebdba4a0b427a3083f89533d905 (patch) | |
tree | 4126fe5e185939a6c2999609910df218109cc8a7 | |
parent | f2911ceebdef567e62f18b7037e85566ab10b4c2 (diff) | |
download | lzy-cefa79506f64eebdba4a0b427a3083f89533d905.tar.gz |
LZY_Log takes variable argument list
-rw-r--r-- | inc/lzy.h | 17 |
1 files changed, 12 insertions, 5 deletions
@@ -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) { |