SDL  2.0
SDL_test_log.c File Reference
#include "SDL_config.h"
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include "SDL.h"
#include "SDL_test.h"
+ Include dependency graph for SDL_test_log.c:

Go to the source code of this file.

Macros

#define _CRT_SECURE_NO_WARNINGS
 

Functions

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

Macro Definition Documentation

#define _CRT_SECURE_NO_WARNINGS

Definition at line 29 of file SDL_test_log.c.

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
fmtMessage 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().

72 {
73  va_list list;
74  char logMessage[SDLTEST_MAX_LOGMESSAGE_LENGTH];
75 
76  /* Print log message into a buffer */
78  va_start(list, fmt);
79  SDL_vsnprintf(logMessage, SDLTEST_MAX_LOGMESSAGE_LENGTH - 1, fmt, list);
80  va_end(list);
81 
82  /* Log with timestamp and newline */
84 }
char * SDLTest_TimestampToString(const time_t timestamp)
Definition: SDL_test_log.c:53
#define SDLTEST_MAX_LOGMESSAGE_LENGTH
Definition: SDL_test.h:58
#define SDL_vsnprintf
#define SDL_LogMessage
#define SDL_memset
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
fmtMessage 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().

90 {
91  va_list list;
92  char logMessage[SDLTEST_MAX_LOGMESSAGE_LENGTH];
93 
94  /* Print log message into a buffer */
96  va_start(list, fmt);
97  SDL_vsnprintf(logMessage, SDLTEST_MAX_LOGMESSAGE_LENGTH - 1, fmt, list);
98  va_end(list);
99 
100  /* Log with timestamp and newline */
102 }
char * SDLTest_TimestampToString(const time_t timestamp)
Definition: SDL_test_log.c:53
#define SDLTEST_MAX_LOGMESSAGE_LENGTH
Definition: SDL_test.h:58
#define SDL_vsnprintf
#define SDL_LogMessage
#define SDL_memset
char* SDLTest_TimestampToString ( const time_t  timestamp)

Definition at line 53 of file SDL_test_log.c.

References SDL_memset.

Referenced by SDLTest_Log(), and SDLTest_LogError().

54 {
55  time_t copy;
56  static char buffer[64];
57  struct tm *local;
58  const char *fmt = "%x %X";
59 
60  SDL_memset(buffer, 0, sizeof(buffer));
61  copy = timestamp;
62  local = localtime(&copy);
63  strftime(buffer, sizeof(buffer), fmt, local);
64 
65  return buffer;
66 }
GLuint buffer
#define SDL_memset