Mercurial
diff seobeo/s_logging.c @ 124:dbf14f84d51c
Refactor Seobeo and mrjunejune build files so it works.
| author | June Park <parkjune1995@gmail.com> |
|---|---|
| date | Thu, 08 Jan 2026 07:31:32 -0800 |
| parents | |
| children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/seobeo/s_logging.c Thu Jan 08 07:31:32 2026 -0800 @@ -0,0 +1,30 @@ +#include "seobeo/seobeo.h" + +static char *Seobeo_Log_Level_String(Seobeo_Log_Level level) +{ + switch(level) + { + case SEOBEO_DEBUG: return "DEBUG"; + case SEOBEO_INFO: return "INFO"; + case SEOBEO_WARNING: return "WARNING"; + case SEOBEO_ERROR: return "ERROR"; + default: return "INFO"; + } +} + +int Seobeo_Log(Seobeo_Log_Level level, const char * restrict format, ...) +{ + #ifndef SEOBEO_ENABLE_DEBUG + if (level == SEOBEO_DEBUG) + return 0; + #endif + + int result; + va_list args; + printf("[%s] ", Seobeo_Log_Level_String(level)); + va_start(args, format); + result = vprintf(format, args); + va_end(args); + + return result; +}