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.

Functions

static 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...
 

Function Documentation

◆ SDLTest_Log()

◆ SDLTest_LogError()

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 103 of file SDL_test_log.c.

104 {
105  va_list list;
106  char logMessage[SDLTEST_MAX_LOGMESSAGE_LENGTH];
107 
108  /* Print log message into a buffer */
110  va_start(list, fmt);
111  SDL_vsnprintf(logMessage, SDLTEST_MAX_LOGMESSAGE_LENGTH - 1, fmt, list);
112  va_end(list);
113 
114  /* Log with timestamp and newline */
116 }

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

◆ SDLTest_TimestampToString()

static char* SDLTest_TimestampToString ( const time_t  timestamp)
static

Definition at line 68 of file SDL_test_log.c.

69 {
70  time_t copy;
71  static char buffer[64];
72  struct tm *local;
73 
74  SDL_memset(buffer, 0, sizeof(buffer));
75  copy = timestamp;
76  local = localtime(&copy);
77  strftime(buffer, sizeof(buffer), "%x %X", local);
78 
79  return buffer;
80 }

References SDL_memset.

Referenced by SDLTest_Log(), and SDLTest_LogError().

SDL_memset
#define SDL_memset
Definition: SDL_dynapi_overrides.h:386
time
EGLSurface EGLnsecsANDROID time
Definition: eglext.h:518
SDLTEST_MAX_LOGMESSAGE_LENGTH
#define SDLTEST_MAX_LOGMESSAGE_LENGTH
Definition: SDL_test.h:59
SDL_LOG_CATEGORY_TEST
@ SDL_LOG_CATEGORY_TEST
Definition: SDL_log.h:74
buffer
GLuint buffer
Definition: SDL_opengl_glext.h:536
SDL_LogMessage
#define SDL_LogMessage
Definition: SDL_dynapi_overrides.h:38
SDL_vsnprintf
#define SDL_vsnprintf
Definition: SDL_dynapi_overrides.h:421
SDLTest_TimestampToString
static char * SDLTest_TimestampToString(const time_t timestamp)
Definition: SDL_test_log.c:68
SDL_LOG_PRIORITY_ERROR
@ SDL_LOG_PRIORITY_ERROR
Definition: SDL_log.h:108
SDL_LOG_PRIORITY_INFO
@ SDL_LOG_PRIORITY_INFO
Definition: SDL_log.h:106