SDL 1.3 is now under the zlib license.
2 Simple DirectMedia Layer
3 Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
5 This software is provided 'as-is', without any express or implied
6 warranty. In no event will the authors be held liable for any damages
7 arising from the use of this software.
9 Permission is granted to anyone to use this software for any purpose,
10 including commercial applications, and to alter it and redistribute it
11 freely, subject to the following restrictions:
13 1. The origin of this software must not be misrepresented; you must not
14 claim that you wrote the original software. If you use this software
15 in a product, an acknowledgment in the product documentation would be
16 appreciated but is not required.
17 2. Altered source versions must be plainly marked as such, and must not be
18 misrepresented as being the original software.
19 3. This notice may not be removed or altered from any source distribution.
25 * Simple log messages with categories and priorities.
27 * By default logs are quiet, but if you're debugging SDL you might want:
29 * SDL_LogSetAllPriority(SDL_LOG_PRIORITY_WARN);
31 * Here's where the messages go on different platforms:
32 * Windows: debug output stream
34 * Others: standard error output (stderr)
40 #include "SDL_stdinc.h"
42 #include "begin_code.h"
43 /* Set up for C function definitions, even when using C++ */
52 * \brief The maximum size of a log message
54 * Messages longer than the maximum size will be truncated
56 #define SDL_MAX_LOG_MESSAGE 4096
59 * \brief The predefined log categories
61 * By default the application category is enabled at the INFO level,
62 * and all other categories are enabled at the CRITICAL level.
66 SDL_LOG_CATEGORY_APPLICATION,
67 SDL_LOG_CATEGORY_ERROR,
68 SDL_LOG_CATEGORY_SYSTEM,
69 SDL_LOG_CATEGORY_AUDIO,
70 SDL_LOG_CATEGORY_VIDEO,
71 SDL_LOG_CATEGORY_RENDER,
72 SDL_LOG_CATEGORY_INPUT,
74 /* Reserved for future SDL library use */
75 SDL_LOG_CATEGORY_RESERVED1,
76 SDL_LOG_CATEGORY_RESERVED2,
77 SDL_LOG_CATEGORY_RESERVED3,
78 SDL_LOG_CATEGORY_RESERVED4,
79 SDL_LOG_CATEGORY_RESERVED5,
80 SDL_LOG_CATEGORY_RESERVED6,
81 SDL_LOG_CATEGORY_RESERVED7,
82 SDL_LOG_CATEGORY_RESERVED8,
83 SDL_LOG_CATEGORY_RESERVED9,
84 SDL_LOG_CATEGORY_RESERVED10,
86 /* Beyond this point is reserved for application use, e.g.
88 MYAPP_CATEGORY_AWESOME1 = SDL_LOG_CATEGORY_CUSTOM,
89 MYAPP_CATEGORY_AWESOME2,
90 MYAPP_CATEGORY_AWESOME3,
94 SDL_LOG_CATEGORY_CUSTOM
98 * \brief The predefined log priorities
102 SDL_LOG_PRIORITY_VERBOSE = 1,
103 SDL_LOG_PRIORITY_DEBUG,
104 SDL_LOG_PRIORITY_INFO,
105 SDL_LOG_PRIORITY_WARN,
106 SDL_LOG_PRIORITY_ERROR,
107 SDL_LOG_PRIORITY_CRITICAL,
108 SDL_NUM_LOG_PRIORITIES
113 * \brief Set the priority of all log categories
115 extern DECLSPEC void SDLCALL SDL_LogSetAllPriority(SDL_LogPriority priority);
118 * \brief Set the priority of a particular log category
120 extern DECLSPEC void SDLCALL SDL_LogSetPriority(int category,
121 SDL_LogPriority priority);
124 * \brief Set the priority of a particular log category
126 extern DECLSPEC SDL_LogPriority SDLCALL SDL_LogGetPriority(int category);
129 * \brief Reset all priorities to default.
131 * \note This is called in SDL_Quit().
133 extern DECLSPEC void SDLCALL SDL_LogResetPriorities(void);
136 * \brief Log a message with SDL_LOG_CATEGORY_APPLICATION and SDL_LOG_PRIORITY_INFO
138 extern DECLSPEC void SDLCALL SDL_Log(const char *fmt, ...);
141 * \brief Log a message with SDL_LOG_PRIORITY_VERBOSE
143 extern DECLSPEC void SDLCALL SDL_LogVerbose(int category, const char *fmt, ...);
146 * \brief Log a message with SDL_LOG_PRIORITY_DEBUG
148 extern DECLSPEC void SDLCALL SDL_LogDebug(int category, const char *fmt, ...);
151 * \brief Log a message with SDL_LOG_PRIORITY_INFO
153 extern DECLSPEC void SDLCALL SDL_LogInfo(int category, const char *fmt, ...);
156 * \brief Log a message with SDL_LOG_PRIORITY_WARN
158 extern DECLSPEC void SDLCALL SDL_LogWarn(int category, const char *fmt, ...);
161 * \brief Log a message with SDL_LOG_PRIORITY_ERROR
163 extern DECLSPEC void SDLCALL SDL_LogError(int category, const char *fmt, ...);
166 * \brief Log a message with SDL_LOG_PRIORITY_CRITICAL
168 extern DECLSPEC void SDLCALL SDL_LogCritical(int category, const char *fmt, ...);
171 * \brief Log a message with the specified category and priority.
173 extern DECLSPEC void SDLCALL SDL_LogMessage(int category,
174 SDL_LogPriority priority,
175 const char *fmt, ...);
178 * \brief Log a message with the specified category and priority.
180 extern DECLSPEC void SDLCALL SDL_LogMessageV(int category,
181 SDL_LogPriority priority,
182 const char *fmt, va_list ap);
185 * \brief The prototype for the log output function
187 typedef void (*SDL_LogOutputFunction)(void *userdata, int category, SDL_LogPriority priority, const char *message);
190 * \brief Get the current log output function.
192 extern DECLSPEC void SDLCALL SDL_LogGetOutputFunction(SDL_LogOutputFunction *callback, void **userdata);
195 * \brief This function allows you to replace the default log output
196 * function with one of your own.
198 extern DECLSPEC void SDLCALL SDL_LogSetOutputFunction(SDL_LogOutputFunction callback, void *userdata);
201 /* Ends C function definitions when using C++ */
207 #include "close_code.h"
209 #endif /* _SDL_log_h */
211 /* vi: set ts=4 sw=4 expandtab: */