SDL Library

Dependents:   H261_decoder

Committer:
miruga27
Date:
Thu Sep 22 00:03:09 2016 +0000
Revision:
0:7fb6877b5d7c
SDL

Who changed what in which revision?

UserRevisionLine numberNew contents of line
miruga27 0:7fb6877b5d7c 1 /*
miruga27 0:7fb6877b5d7c 2 Simple DirectMedia Layer
miruga27 0:7fb6877b5d7c 3 Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
miruga27 0:7fb6877b5d7c 4
miruga27 0:7fb6877b5d7c 5 This software is provided 'as-is', without any express or implied
miruga27 0:7fb6877b5d7c 6 warranty. In no event will the authors be held liable for any damages
miruga27 0:7fb6877b5d7c 7 arising from the use of this software.
miruga27 0:7fb6877b5d7c 8
miruga27 0:7fb6877b5d7c 9 Permission is granted to anyone to use this software for any purpose,
miruga27 0:7fb6877b5d7c 10 including commercial applications, and to alter it and redistribute it
miruga27 0:7fb6877b5d7c 11 freely, subject to the following restrictions:
miruga27 0:7fb6877b5d7c 12
miruga27 0:7fb6877b5d7c 13 1. The origin of this software must not be misrepresented; you must not
miruga27 0:7fb6877b5d7c 14 claim that you wrote the original software. If you use this software
miruga27 0:7fb6877b5d7c 15 in a product, an acknowledgment in the product documentation would be
miruga27 0:7fb6877b5d7c 16 appreciated but is not required.
miruga27 0:7fb6877b5d7c 17 2. Altered source versions must be plainly marked as such, and must not be
miruga27 0:7fb6877b5d7c 18 misrepresented as being the original software.
miruga27 0:7fb6877b5d7c 19 3. This notice may not be removed or altered from any source distribution.
miruga27 0:7fb6877b5d7c 20 */
miruga27 0:7fb6877b5d7c 21
miruga27 0:7fb6877b5d7c 22 /**
miruga27 0:7fb6877b5d7c 23 * \file SDL_log.h
miruga27 0:7fb6877b5d7c 24 *
miruga27 0:7fb6877b5d7c 25 * Simple log messages with categories and priorities.
miruga27 0:7fb6877b5d7c 26 *
miruga27 0:7fb6877b5d7c 27 * By default logs are quiet, but if you're debugging SDL you might want:
miruga27 0:7fb6877b5d7c 28 *
miruga27 0:7fb6877b5d7c 29 * SDL_LogSetAllPriority(SDL_LOG_PRIORITY_WARN);
miruga27 0:7fb6877b5d7c 30 *
miruga27 0:7fb6877b5d7c 31 * Here's where the messages go on different platforms:
miruga27 0:7fb6877b5d7c 32 * Windows: debug output stream
miruga27 0:7fb6877b5d7c 33 * Android: log output
miruga27 0:7fb6877b5d7c 34 * Others: standard error output (stderr)
miruga27 0:7fb6877b5d7c 35 */
miruga27 0:7fb6877b5d7c 36
miruga27 0:7fb6877b5d7c 37 #ifndef _SDL_log_h
miruga27 0:7fb6877b5d7c 38 #define _SDL_log_h
miruga27 0:7fb6877b5d7c 39
miruga27 0:7fb6877b5d7c 40 #include "SDL_stdinc.h"
miruga27 0:7fb6877b5d7c 41
miruga27 0:7fb6877b5d7c 42 #include "begin_code.h"
miruga27 0:7fb6877b5d7c 43 /* Set up for C function definitions, even when using C++ */
miruga27 0:7fb6877b5d7c 44 #ifdef __cplusplus
miruga27 0:7fb6877b5d7c 45 extern "C" {
miruga27 0:7fb6877b5d7c 46 #endif
miruga27 0:7fb6877b5d7c 47
miruga27 0:7fb6877b5d7c 48
miruga27 0:7fb6877b5d7c 49 /**
miruga27 0:7fb6877b5d7c 50 * \brief The maximum size of a log message
miruga27 0:7fb6877b5d7c 51 *
miruga27 0:7fb6877b5d7c 52 * Messages longer than the maximum size will be truncated
miruga27 0:7fb6877b5d7c 53 */
miruga27 0:7fb6877b5d7c 54 #define SDL_MAX_LOG_MESSAGE 4096
miruga27 0:7fb6877b5d7c 55
miruga27 0:7fb6877b5d7c 56 /**
miruga27 0:7fb6877b5d7c 57 * \brief The predefined log categories
miruga27 0:7fb6877b5d7c 58 *
miruga27 0:7fb6877b5d7c 59 * By default the application category is enabled at the INFO level,
miruga27 0:7fb6877b5d7c 60 * the assert category is enabled at the WARN level, test is enabled
miruga27 0:7fb6877b5d7c 61 * at the VERBOSE level and all other categories are enabled at the
miruga27 0:7fb6877b5d7c 62 * CRITICAL level.
miruga27 0:7fb6877b5d7c 63 */
miruga27 0:7fb6877b5d7c 64 enum
miruga27 0:7fb6877b5d7c 65 {
miruga27 0:7fb6877b5d7c 66 SDL_LOG_CATEGORY_APPLICATION,
miruga27 0:7fb6877b5d7c 67 SDL_LOG_CATEGORY_ERROR,
miruga27 0:7fb6877b5d7c 68 SDL_LOG_CATEGORY_ASSERT,
miruga27 0:7fb6877b5d7c 69 SDL_LOG_CATEGORY_SYSTEM,
miruga27 0:7fb6877b5d7c 70 SDL_LOG_CATEGORY_AUDIO,
miruga27 0:7fb6877b5d7c 71 SDL_LOG_CATEGORY_VIDEO,
miruga27 0:7fb6877b5d7c 72 SDL_LOG_CATEGORY_RENDER,
miruga27 0:7fb6877b5d7c 73 SDL_LOG_CATEGORY_INPUT,
miruga27 0:7fb6877b5d7c 74 SDL_LOG_CATEGORY_TEST,
miruga27 0:7fb6877b5d7c 75
miruga27 0:7fb6877b5d7c 76 /* Reserved for future SDL library use */
miruga27 0:7fb6877b5d7c 77 SDL_LOG_CATEGORY_RESERVED1,
miruga27 0:7fb6877b5d7c 78 SDL_LOG_CATEGORY_RESERVED2,
miruga27 0:7fb6877b5d7c 79 SDL_LOG_CATEGORY_RESERVED3,
miruga27 0:7fb6877b5d7c 80 SDL_LOG_CATEGORY_RESERVED4,
miruga27 0:7fb6877b5d7c 81 SDL_LOG_CATEGORY_RESERVED5,
miruga27 0:7fb6877b5d7c 82 SDL_LOG_CATEGORY_RESERVED6,
miruga27 0:7fb6877b5d7c 83 SDL_LOG_CATEGORY_RESERVED7,
miruga27 0:7fb6877b5d7c 84 SDL_LOG_CATEGORY_RESERVED8,
miruga27 0:7fb6877b5d7c 85 SDL_LOG_CATEGORY_RESERVED9,
miruga27 0:7fb6877b5d7c 86 SDL_LOG_CATEGORY_RESERVED10,
miruga27 0:7fb6877b5d7c 87
miruga27 0:7fb6877b5d7c 88 /* Beyond this point is reserved for application use, e.g.
miruga27 0:7fb6877b5d7c 89 enum {
miruga27 0:7fb6877b5d7c 90 MYAPP_CATEGORY_AWESOME1 = SDL_LOG_CATEGORY_CUSTOM,
miruga27 0:7fb6877b5d7c 91 MYAPP_CATEGORY_AWESOME2,
miruga27 0:7fb6877b5d7c 92 MYAPP_CATEGORY_AWESOME3,
miruga27 0:7fb6877b5d7c 93 ...
miruga27 0:7fb6877b5d7c 94 };
miruga27 0:7fb6877b5d7c 95 */
miruga27 0:7fb6877b5d7c 96 SDL_LOG_CATEGORY_CUSTOM
miruga27 0:7fb6877b5d7c 97 };
miruga27 0:7fb6877b5d7c 98
miruga27 0:7fb6877b5d7c 99 /**
miruga27 0:7fb6877b5d7c 100 * \brief The predefined log priorities
miruga27 0:7fb6877b5d7c 101 */
miruga27 0:7fb6877b5d7c 102 typedef enum
miruga27 0:7fb6877b5d7c 103 {
miruga27 0:7fb6877b5d7c 104 SDL_LOG_PRIORITY_VERBOSE = 1,
miruga27 0:7fb6877b5d7c 105 SDL_LOG_PRIORITY_DEBUG,
miruga27 0:7fb6877b5d7c 106 SDL_LOG_PRIORITY_INFO,
miruga27 0:7fb6877b5d7c 107 SDL_LOG_PRIORITY_WARN,
miruga27 0:7fb6877b5d7c 108 SDL_LOG_PRIORITY_ERROR,
miruga27 0:7fb6877b5d7c 109 SDL_LOG_PRIORITY_CRITICAL,
miruga27 0:7fb6877b5d7c 110 SDL_NUM_LOG_PRIORITIES
miruga27 0:7fb6877b5d7c 111 } SDL_LogPriority;
miruga27 0:7fb6877b5d7c 112
miruga27 0:7fb6877b5d7c 113
miruga27 0:7fb6877b5d7c 114 /**
miruga27 0:7fb6877b5d7c 115 * \brief Set the priority of all log categories
miruga27 0:7fb6877b5d7c 116 */
miruga27 0:7fb6877b5d7c 117 extern DECLSPEC void SDLCALL SDL_LogSetAllPriority(SDL_LogPriority priority);
miruga27 0:7fb6877b5d7c 118
miruga27 0:7fb6877b5d7c 119 /**
miruga27 0:7fb6877b5d7c 120 * \brief Set the priority of a particular log category
miruga27 0:7fb6877b5d7c 121 */
miruga27 0:7fb6877b5d7c 122 extern DECLSPEC void SDLCALL SDL_LogSetPriority(int category,
miruga27 0:7fb6877b5d7c 123 SDL_LogPriority priority);
miruga27 0:7fb6877b5d7c 124
miruga27 0:7fb6877b5d7c 125 /**
miruga27 0:7fb6877b5d7c 126 * \brief Get the priority of a particular log category
miruga27 0:7fb6877b5d7c 127 */
miruga27 0:7fb6877b5d7c 128 extern DECLSPEC SDL_LogPriority SDLCALL SDL_LogGetPriority(int category);
miruga27 0:7fb6877b5d7c 129
miruga27 0:7fb6877b5d7c 130 /**
miruga27 0:7fb6877b5d7c 131 * \brief Reset all priorities to default.
miruga27 0:7fb6877b5d7c 132 *
miruga27 0:7fb6877b5d7c 133 * \note This is called in SDL_Quit().
miruga27 0:7fb6877b5d7c 134 */
miruga27 0:7fb6877b5d7c 135 extern DECLSPEC void SDLCALL SDL_LogResetPriorities(void);
miruga27 0:7fb6877b5d7c 136
miruga27 0:7fb6877b5d7c 137 /**
miruga27 0:7fb6877b5d7c 138 * \brief Log a message with SDL_LOG_CATEGORY_APPLICATION and SDL_LOG_PRIORITY_INFO
miruga27 0:7fb6877b5d7c 139 */
miruga27 0:7fb6877b5d7c 140 extern DECLSPEC void SDLCALL SDL_Log(const char *fmt, ...);
miruga27 0:7fb6877b5d7c 141
miruga27 0:7fb6877b5d7c 142 /**
miruga27 0:7fb6877b5d7c 143 * \brief Log a message with SDL_LOG_PRIORITY_VERBOSE
miruga27 0:7fb6877b5d7c 144 */
miruga27 0:7fb6877b5d7c 145 extern DECLSPEC void SDLCALL SDL_LogVerbose(int category, const char *fmt, ...);
miruga27 0:7fb6877b5d7c 146
miruga27 0:7fb6877b5d7c 147 /**
miruga27 0:7fb6877b5d7c 148 * \brief Log a message with SDL_LOG_PRIORITY_DEBUG
miruga27 0:7fb6877b5d7c 149 */
miruga27 0:7fb6877b5d7c 150 extern DECLSPEC void SDLCALL SDL_LogDebug(int category, const char *fmt, ...);
miruga27 0:7fb6877b5d7c 151
miruga27 0:7fb6877b5d7c 152 /**
miruga27 0:7fb6877b5d7c 153 * \brief Log a message with SDL_LOG_PRIORITY_INFO
miruga27 0:7fb6877b5d7c 154 */
miruga27 0:7fb6877b5d7c 155 extern DECLSPEC void SDLCALL SDL_LogInfo(int category, const char *fmt, ...);
miruga27 0:7fb6877b5d7c 156
miruga27 0:7fb6877b5d7c 157 /**
miruga27 0:7fb6877b5d7c 158 * \brief Log a message with SDL_LOG_PRIORITY_WARN
miruga27 0:7fb6877b5d7c 159 */
miruga27 0:7fb6877b5d7c 160 extern DECLSPEC void SDLCALL SDL_LogWarn(int category, const char *fmt, ...);
miruga27 0:7fb6877b5d7c 161
miruga27 0:7fb6877b5d7c 162 /**
miruga27 0:7fb6877b5d7c 163 * \brief Log a message with SDL_LOG_PRIORITY_ERROR
miruga27 0:7fb6877b5d7c 164 */
miruga27 0:7fb6877b5d7c 165 extern DECLSPEC void SDLCALL SDL_LogError(int category, const char *fmt, ...);
miruga27 0:7fb6877b5d7c 166
miruga27 0:7fb6877b5d7c 167 /**
miruga27 0:7fb6877b5d7c 168 * \brief Log a message with SDL_LOG_PRIORITY_CRITICAL
miruga27 0:7fb6877b5d7c 169 */
miruga27 0:7fb6877b5d7c 170 extern DECLSPEC void SDLCALL SDL_LogCritical(int category, const char *fmt, ...);
miruga27 0:7fb6877b5d7c 171
miruga27 0:7fb6877b5d7c 172 /**
miruga27 0:7fb6877b5d7c 173 * \brief Log a message with the specified category and priority.
miruga27 0:7fb6877b5d7c 174 */
miruga27 0:7fb6877b5d7c 175 extern DECLSPEC void SDLCALL SDL_LogMessage(int category,
miruga27 0:7fb6877b5d7c 176 SDL_LogPriority priority,
miruga27 0:7fb6877b5d7c 177 const char *fmt, ...);
miruga27 0:7fb6877b5d7c 178
miruga27 0:7fb6877b5d7c 179 /**
miruga27 0:7fb6877b5d7c 180 * \brief Log a message with the specified category and priority.
miruga27 0:7fb6877b5d7c 181 */
miruga27 0:7fb6877b5d7c 182 extern DECLSPEC void SDLCALL SDL_LogMessageV(int category,
miruga27 0:7fb6877b5d7c 183 SDL_LogPriority priority,
miruga27 0:7fb6877b5d7c 184 const char *fmt, va_list ap);
miruga27 0:7fb6877b5d7c 185
miruga27 0:7fb6877b5d7c 186 /**
miruga27 0:7fb6877b5d7c 187 * \brief The prototype for the log output function
miruga27 0:7fb6877b5d7c 188 */
miruga27 0:7fb6877b5d7c 189 typedef void (*SDL_LogOutputFunction)(void *userdata, int category, SDL_LogPriority priority, const char *message);
miruga27 0:7fb6877b5d7c 190
miruga27 0:7fb6877b5d7c 191 /**
miruga27 0:7fb6877b5d7c 192 * \brief Get the current log output function.
miruga27 0:7fb6877b5d7c 193 */
miruga27 0:7fb6877b5d7c 194 extern DECLSPEC void SDLCALL SDL_LogGetOutputFunction(SDL_LogOutputFunction *callback, void **userdata);
miruga27 0:7fb6877b5d7c 195
miruga27 0:7fb6877b5d7c 196 /**
miruga27 0:7fb6877b5d7c 197 * \brief This function allows you to replace the default log output
miruga27 0:7fb6877b5d7c 198 * function with one of your own.
miruga27 0:7fb6877b5d7c 199 */
miruga27 0:7fb6877b5d7c 200 extern DECLSPEC void SDLCALL SDL_LogSetOutputFunction(SDL_LogOutputFunction callback, void *userdata);
miruga27 0:7fb6877b5d7c 201
miruga27 0:7fb6877b5d7c 202
miruga27 0:7fb6877b5d7c 203 /* Ends C function definitions when using C++ */
miruga27 0:7fb6877b5d7c 204 #ifdef __cplusplus
miruga27 0:7fb6877b5d7c 205 }
miruga27 0:7fb6877b5d7c 206 #endif
miruga27 0:7fb6877b5d7c 207 #include "close_code.h"
miruga27 0:7fb6877b5d7c 208
miruga27 0:7fb6877b5d7c 209 #endif /* _SDL_log_h */
miruga27 0:7fb6877b5d7c 210
miruga27 0:7fb6877b5d7c 211 /* vi: set ts=4 sw=4 expandtab: */