comparison src/SDL_error.c @ 5226:2ee8112bfc6b

Added a simple log message API
author Sam Lantinga <slouken@libsdl.org>
date Mon, 07 Feb 2011 16:45:40 -0800
parents b12d76ef05e2
children b530ef003506
comparison
equal deleted inserted replaced
5225:1fbe1c202501 5226:2ee8112bfc6b
21 */ 21 */
22 #include "SDL_config.h" 22 #include "SDL_config.h"
23 23
24 /* Simple error handling in SDL */ 24 /* Simple error handling in SDL */
25 25
26 #ifdef __ANDROID__ 26 #include "SDL_log.h"
27 #include <android/log.h>
28 #endif
29
30 #include "SDL_error.h" 27 #include "SDL_error.h"
31 #include "SDL_error_c.h" 28 #include "SDL_error_c.h"
32 29
33 /*#define DEBUG_ERROR*/
34 30
35 /* Routine to get the thread-specific error variable */ 31 /* Routine to get the thread-specific error variable */
36 #if SDL_THREADS_DISABLED 32 #if SDL_THREADS_DISABLED
37 /* The default (non-thread-safe) global error variable */ 33 /* The default (non-thread-safe) global error variable */
38 static SDL_error SDL_global_error; 34 static SDL_error SDL_global_error;
111 } 107 }
112 } 108 }
113 va_end(ap); 109 va_end(ap);
114 110
115 /* If we are in debug mode, print out an error message */ 111 /* If we are in debug mode, print out an error message */
116 #ifdef DEBUG_ERROR 112 SDL_LogError(SDL_LOG_CATEGORY_ERROR, "%s", SDL_GetError());
117 fprintf(stderr, "SDL_SetError: %s\n", SDL_GetError());
118 #ifdef __ANDROID__
119 __android_log_print(ANDROID_LOG_INFO, "SDL", "ERROR: %s", SDL_GetError());
120 #endif
121 #endif /* DEBUG_ERROR */
122 } 113 }
123 114
124 /* This function has a bit more overhead than most error functions 115 /* This function has a bit more overhead than most error functions
125 so that it supports internationalization and thread-safe errors. 116 so that it supports internationalization and thread-safe errors.
126 */ 117 */