/* * Prints given message with a timestamp in the TEST category and the ERROR priority. */ void SDLTest_LogError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { va_list list; char logMessage[SDLTEST_MAX_LOGMESSAGE_LENGTH]; /* Print log message into a buffer */ SDL_memset(logMessage, 0, SDLTEST_MAX_LOGMESSAGE_LENGTH); va_start(list, fmt); SDL_vsnprintf(logMessage, SDLTEST_MAX_LOGMESSAGE_LENGTH - 1, fmt, list); va_end(list); /* Log with timestamp and newline */ SDL_LogMessage(SDL_LOG_CATEGORY_TEST, SDL_LOG_PRIORITY_ERROR, "%s: %s", SDLTest_TimestampToString(time(0)), logMessage); }
/* * Prints given message with a timestamp in the TEST category and INFO priority. */ void SDLTest_Log(char *fmt, ...) { va_list list; char logMessage[SDLTEST_MAX_LOGMESSAGE_LENGTH]; // Print log message into a buffer memset(logMessage, 0, SDLTEST_MAX_LOGMESSAGE_LENGTH); va_start(list, fmt); SDL_vsnprintf(logMessage, SDLTEST_MAX_LOGMESSAGE_LENGTH - 1, fmt, list); va_end(list); // Log with timestamp and newline SDL_LogMessage(SDL_LOG_CATEGORY_TEST, SDL_LOG_PRIORITY_INFO, "%s: %s\n", SDLTest_TimestampToString(time(0)), logMessage); }