SDL_test_log.h File Reference
`#include "begin_code.h"`
`#include "close_code.h"`
Include dependency graph for SDL_test_log.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Functions

void | SDLTest_Log (SDL_PRINTF_FORMAT_STRING const char *fmt,...) SDL_PRINTF_VARARG_FUNC(1)
| Prints given message with a timestamp in the TEST category and INFO priority. More...
void | SDLTest_LogError (SDL_PRINTF_FORMAT_STRING const char *fmt,...) SDL_PRINTF_VARARG_FUNC(1)
| Prints given message with a timestamp in the TEST category and the ERROR priority. More...

## Detailed Description

Include file for SDL test framework.

This code is a part of the SDL2_test library, not the main SDL library.

Definition in file SDL_test_log.h.

## Function Documentation

void SDLTest_Log | ( | SDL_PRINTF_FORMAT_STRING const char * | fmt,
|  |  | ...
| ) |  |

Prints given message with a timestamp in the TEST category and INFO priority.

Parameters

  fmt | Message to be logged

Definition at line 71 of file SDL_test_log.c.

References SDL_LOG_CATEGORY_TEST, SDL_LOG_PRIORITY_INFO, SDL_LogMessage, SDL_memset, SDL_vsnprintf, SDLTEST_MAX_LOGMESSAGE_LENGTH, and SDLTest_TimestampToString().

Referenced by audio_buildAudioCVTNegative(), audio_convertAudio(), audio_enumerateAndNameAudioDevices(), audio_lockUnlockOpenAudioDevice(), audio_openCloseAndGetAudioStatus(), audio_openCloseAudioDeviceConnected(), audio_pauseUnpauseAudio(), pixels_allocFreeFormat(), pixels_getPixelFormatName(), rwops_testFileWriteReadEndian(), SDLTest_AssertCheck(), SDLTest_AssertPass(), SDLTest_LogAssertSummary(), SDLTest_LogTestSuiteSummary(), SDLTest_RunSuites(), SDLTest_RunTest(), stdlib_getsetenv(), syswm_getWindowWMInfo(), video_getClosestDisplayModeCurrentResolution(), and video_getClosestDisplayModeRandomResolution().

{
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_INFO, " %s: %s", SDLTest_TimestampToString(time(0)), logMessage);
}
SDLTest_TimestampToString
char * SDLTest_TimestampToString(const time_t timestamp)
Definition: SDL_test_log.c:53
SDLTEST_MAX_LOGMESSAGE_LENGTH
#define SDLTEST_MAX_LOGMESSAGE_LENGTH
Definition: SDL_test.h:58
SDL_vsnprintf
#define SDL_vsnprintf
Definition: SDL_dynapi_overrides.h:427
SDL_LogMessage
#define SDL_LogMessage
Definition: SDL_dynapi_overrides.h:44
SDL_LOG_PRIORITY_INFO
Definition: SDL_log.h:106
SDL_LOG_CATEGORY_TEST
Definition: SDL_log.h:74
SDL_memset
#define SDL_memset
Definition: SDL_dynapi_overrides.h:392

void SDLTest_LogError | ( | SDL_PRINTF_FORMAT_STRING const char * | fmt,
|  |  | ...
| ) |  |

Prints given message with a timestamp in the TEST category and the ERROR priority.

Parameters

  fmt | Message to be logged

Definition at line 89 of file SDL_test_log.c.

References SDL_LOG_CATEGORY_TEST, SDL_LOG_PRIORITY_ERROR, SDL_LogMessage, SDL_memset, SDL_vsnprintf, SDLTEST_MAX_LOGMESSAGE_LENGTH, and SDLTest_TimestampToString().

Referenced by _audioSetUp(), _loadTestFace(), _timerSetUp(), audio_buildAudioCVT(), audio_convertAudio(), SDLTest_AssertCheck(), SDLTest_BailOut(), SDLTest_CompareSurfaces(), SDLTest_GenerateExecKey(), SDLTest_GenerateRunSeed(), SDLTest_LogAssertSummary(), sdltest_randomAsciiString(), sdltest_randomAsciiStringOfSize(), sdltest_randomAsciiStringWithMaximumLength(), SDLTest_RunSuites(), SDLTest_RunTest(), and SDLTest_SetTestTimeout().

{
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);
}
SDL_LOG_PRIORITY_ERROR
Definition: SDL_log.h:108
SDLTest_TimestampToString
char * SDLTest_TimestampToString(const time_t timestamp)
Definition: SDL_test_log.c:53
SDLTEST_MAX_LOGMESSAGE_LENGTH
#define SDLTEST_MAX_LOGMESSAGE_LENGTH
Definition: SDL_test.h:58
SDL_vsnprintf
#define SDL_vsnprintf
Definition: SDL_dynapi_overrides.h:427
SDL_LogMessage
#define SDL_LogMessage
Definition: SDL_dynapi_overrides.h:44
SDL_LOG_CATEGORY_TEST
Definition: SDL_log.h:74
SDL_memset
#define SDL_memset
Definition: SDL_dynapi_overrides.h:392