assaultfish/engine/src/log.c

27 lines
506 B
C
Raw Normal View History

2026-01-12 01:54:35 +09:00
#include <GearSrc/Log.h>
2026-01-09 00:40:51 +09:00
2026-01-12 01:54:35 +09:00
void GSLog(int level, const char* fmt, ...) {
2026-01-09 00:40:51 +09:00
va_list va;
FILE* out = stdout;
#ifdef _WIN32
#else
2026-01-12 01:54:35 +09:00
fprintf(out, "[\x1b[mGearSrc\x1b[m|");
2026-01-09 00:40:51 +09:00
2026-01-12 01:54:35 +09:00
if(level == GSLogInfo) {
2026-01-09 00:40:51 +09:00
fprintf(out, "\x1b[1mINFO\x1b[m ");
2026-01-12 01:54:35 +09:00
} else if(level == GSLogWarn) {
2026-01-09 00:40:51 +09:00
fprintf(out, "\x1b[1m\x1b[33mWARN\x1b[m ");
2026-01-12 01:54:35 +09:00
} else if(level == GSLogError) {
2026-01-09 00:40:51 +09:00
fprintf(out, "\x1b[1m\x1b[31mERROR\x1b[m");
}
#endif
fprintf(out, "] ");
va_start(va, fmt);
vfprintf(out, fmt, va);
va_end(va);
fprintf(out, "\n");
}