convert Warning() and DEBUG() to GFX2_Log()

This commit is contained in:
Thomas Bernard
2018-07-12 20:41:49 +02:00
parent 90bcffa9e2
commit 4978a7cfe2
11 changed files with 111 additions and 79 deletions

View File

@@ -34,12 +34,23 @@ extern void GFX2_Log(GFX2_Log_priority_T priority, const char * fmt, ...)
va_start(ap, fmt);
GFX2_LogV(priority, fmt, ap);
va_end(ap);
#if defined(_MSC_VER) && defined(DEBUG)
{
char message[1024];
va_start(ap, fmt);
vsnprintf(message, sizeof(message), fmt, ap);
va_end(ap);
OutputDebugStringA(message);
}
#endif
}
extern void GFX2_LogV(GFX2_Log_priority_T priority, const char * fmt, va_list ap)
{
#if !defined(DEBUG)
if ((unsigned)GFX2_verbosity_level < (unsigned)priority)
return;
#endif
#if defined(USE_SDL2)
{
int sdl_priority;
@@ -62,6 +73,7 @@ extern void GFX2_LogV(GFX2_Log_priority_T priority, const char * fmt, va_list ap
}
SDL_LogMessageV(SDL_LOG_CATEGORY_APPLICATION, sdl_priority, fmt, ap);
}
#endif
#else
vfprintf((unsigned)priority >= GFX2_INFO ? stdout : stderr, fmt, ap);
#endif
}