SDL Library
Embed:
(wiki syntax)
Show/hide line numbers
SDL_log.h
Go to the documentation of this file.
00001 /* 00002 Simple DirectMedia Layer 00003 Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> 00004 00005 This software is provided 'as-is', without any express or implied 00006 warranty. In no event will the authors be held liable for any damages 00007 arising from the use of this software. 00008 00009 Permission is granted to anyone to use this software for any purpose, 00010 including commercial applications, and to alter it and redistribute it 00011 freely, subject to the following restrictions: 00012 00013 1. The origin of this software must not be misrepresented; you must not 00014 claim that you wrote the original software. If you use this software 00015 in a product, an acknowledgment in the product documentation would be 00016 appreciated but is not required. 00017 2. Altered source versions must be plainly marked as such, and must not be 00018 misrepresented as being the original software. 00019 3. This notice may not be removed or altered from any source distribution. 00020 */ 00021 00022 /** 00023 * \file SDL_log.h 00024 * 00025 * Simple log messages with categories and priorities. 00026 * 00027 * By default logs are quiet, but if you're debugging SDL you might want: 00028 * 00029 * SDL_LogSetAllPriority(SDL_LOG_PRIORITY_WARN); 00030 * 00031 * Here's where the messages go on different platforms: 00032 * Windows: debug output stream 00033 * Android: log output 00034 * Others: standard error output (stderr) 00035 */ 00036 00037 #ifndef _SDL_log_h 00038 #define _SDL_log_h 00039 00040 #include "SDL_stdinc.h" 00041 00042 #include "begin_code.h" 00043 /* Set up for C function definitions, even when using C++ */ 00044 #ifdef __cplusplus 00045 extern "C" { 00046 #endif 00047 00048 00049 /** 00050 * \brief The maximum size of a log message 00051 * 00052 * Messages longer than the maximum size will be truncated 00053 */ 00054 #define SDL_MAX_LOG_MESSAGE 4096 00055 00056 /** 00057 * \brief The predefined log categories 00058 * 00059 * By default the application category is enabled at the INFO level, 00060 * the assert category is enabled at the WARN level, test is enabled 00061 * at the VERBOSE level and all other categories are enabled at the 00062 * CRITICAL level. 00063 */ 00064 enum 00065 { 00066 SDL_LOG_CATEGORY_APPLICATION, 00067 SDL_LOG_CATEGORY_ERROR, 00068 SDL_LOG_CATEGORY_ASSERT, 00069 SDL_LOG_CATEGORY_SYSTEM, 00070 SDL_LOG_CATEGORY_AUDIO, 00071 SDL_LOG_CATEGORY_VIDEO, 00072 SDL_LOG_CATEGORY_RENDER, 00073 SDL_LOG_CATEGORY_INPUT, 00074 SDL_LOG_CATEGORY_TEST, 00075 00076 /* Reserved for future SDL library use */ 00077 SDL_LOG_CATEGORY_RESERVED1, 00078 SDL_LOG_CATEGORY_RESERVED2, 00079 SDL_LOG_CATEGORY_RESERVED3, 00080 SDL_LOG_CATEGORY_RESERVED4, 00081 SDL_LOG_CATEGORY_RESERVED5, 00082 SDL_LOG_CATEGORY_RESERVED6, 00083 SDL_LOG_CATEGORY_RESERVED7, 00084 SDL_LOG_CATEGORY_RESERVED8, 00085 SDL_LOG_CATEGORY_RESERVED9, 00086 SDL_LOG_CATEGORY_RESERVED10, 00087 00088 /* Beyond this point is reserved for application use, e.g. 00089 enum { 00090 MYAPP_CATEGORY_AWESOME1 = SDL_LOG_CATEGORY_CUSTOM, 00091 MYAPP_CATEGORY_AWESOME2, 00092 MYAPP_CATEGORY_AWESOME3, 00093 ... 00094 }; 00095 */ 00096 SDL_LOG_CATEGORY_CUSTOM 00097 }; 00098 00099 /** 00100 * \brief The predefined log priorities 00101 */ 00102 typedef enum 00103 { 00104 SDL_LOG_PRIORITY_VERBOSE = 1, 00105 SDL_LOG_PRIORITY_DEBUG, 00106 SDL_LOG_PRIORITY_INFO, 00107 SDL_LOG_PRIORITY_WARN, 00108 SDL_LOG_PRIORITY_ERROR, 00109 SDL_LOG_PRIORITY_CRITICAL, 00110 SDL_NUM_LOG_PRIORITIES 00111 } SDL_LogPriority; 00112 00113 00114 /** 00115 * \brief Set the priority of all log categories 00116 */ 00117 extern DECLSPEC void SDLCALL SDL_LogSetAllPriority(SDL_LogPriority priority); 00118 00119 /** 00120 * \brief Set the priority of a particular log category 00121 */ 00122 extern DECLSPEC void SDLCALL SDL_LogSetPriority(int category, 00123 SDL_LogPriority priority); 00124 00125 /** 00126 * \brief Get the priority of a particular log category 00127 */ 00128 extern DECLSPEC SDL_LogPriority SDLCALL SDL_LogGetPriority(int category); 00129 00130 /** 00131 * \brief Reset all priorities to default. 00132 * 00133 * \note This is called in SDL_Quit(). 00134 */ 00135 extern DECLSPEC void SDLCALL SDL_LogResetPriorities(void); 00136 00137 /** 00138 * \brief Log a message with SDL_LOG_CATEGORY_APPLICATION and SDL_LOG_PRIORITY_INFO 00139 */ 00140 extern DECLSPEC void SDLCALL SDL_Log(const char *fmt, ...); 00141 00142 /** 00143 * \brief Log a message with SDL_LOG_PRIORITY_VERBOSE 00144 */ 00145 extern DECLSPEC void SDLCALL SDL_LogVerbose(int category, const char *fmt, ...); 00146 00147 /** 00148 * \brief Log a message with SDL_LOG_PRIORITY_DEBUG 00149 */ 00150 extern DECLSPEC void SDLCALL SDL_LogDebug(int category, const char *fmt, ...); 00151 00152 /** 00153 * \brief Log a message with SDL_LOG_PRIORITY_INFO 00154 */ 00155 extern DECLSPEC void SDLCALL SDL_LogInfo(int category, const char *fmt, ...); 00156 00157 /** 00158 * \brief Log a message with SDL_LOG_PRIORITY_WARN 00159 */ 00160 extern DECLSPEC void SDLCALL SDL_LogWarn(int category, const char *fmt, ...); 00161 00162 /** 00163 * \brief Log a message with SDL_LOG_PRIORITY_ERROR 00164 */ 00165 extern DECLSPEC void SDLCALL SDL_LogError(int category, const char *fmt, ...); 00166 00167 /** 00168 * \brief Log a message with SDL_LOG_PRIORITY_CRITICAL 00169 */ 00170 extern DECLSPEC void SDLCALL SDL_LogCritical(int category, const char *fmt, ...); 00171 00172 /** 00173 * \brief Log a message with the specified category and priority. 00174 */ 00175 extern DECLSPEC void SDLCALL SDL_LogMessage(int category, 00176 SDL_LogPriority priority, 00177 const char *fmt, ...); 00178 00179 /** 00180 * \brief Log a message with the specified category and priority. 00181 */ 00182 extern DECLSPEC void SDLCALL SDL_LogMessageV(int category, 00183 SDL_LogPriority priority, 00184 const char *fmt, va_list ap); 00185 00186 /** 00187 * \brief The prototype for the log output function 00188 */ 00189 typedef void (*SDL_LogOutputFunction)(void *userdata, int category, SDL_LogPriority priority, const char *message); 00190 00191 /** 00192 * \brief Get the current log output function. 00193 */ 00194 extern DECLSPEC void SDLCALL SDL_LogGetOutputFunction(SDL_LogOutputFunction *callback, void **userdata); 00195 00196 /** 00197 * \brief This function allows you to replace the default log output 00198 * function with one of your own. 00199 */ 00200 extern DECLSPEC void SDLCALL SDL_LogSetOutputFunction(SDL_LogOutputFunction callback, void *userdata); 00201 00202 00203 /* Ends C function definitions when using C++ */ 00204 #ifdef __cplusplus 00205 } 00206 #endif 00207 #include "close_code.h" 00208 00209 #endif /* _SDL_log_h */ 00210 00211 /* vi: set ts=4 sw=4 expandtab: */
Generated on Tue Jul 12 2022 15:10:19 by 1.7.2