2 SDL - Simple DirectMedia Layer
3 Copyright (C) 1997-2011 Sam Lantinga
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 * Simple log messages with categories and priorities.
28 * By default logs are quiet, but if you're debugging SDL you might want:
30 * SDL_LogSetAllPriority(SDL_LOG_PRIORITY_WARN);
32 * Here's where the messages go on different platforms:
33 * Windows: debug output stream
35 * Others: standard error output (stderr)
41 #include "SDL_stdinc.h"
43 #include "begin_code.h"
44 /* Set up for C function definitions, even when using C++ */
53 * \brief The maximum size of a log message
55 * Messages longer than the maximum size will be truncated
57 #define SDL_MAX_LOG_MESSAGE 4096
60 * \brief The predefined log categories
62 * By default the application category is enabled at the INFO level,
63 * and all other categories are enabled at the CRITICAL level.
67 SDL_LOG_CATEGORY_APPLICATION,
68 SDL_LOG_CATEGORY_ERROR,
69 SDL_LOG_CATEGORY_SYSTEM,
70 SDL_LOG_CATEGORY_AUDIO,
71 SDL_LOG_CATEGORY_VIDEO,
72 SDL_LOG_CATEGORY_RENDER,
73 SDL_LOG_CATEGORY_INPUT,
75 /* Reserved for future SDL library use */
76 SDL_LOG_CATEGORY_RESERVED1,
77 SDL_LOG_CATEGORY_RESERVED2,
78 SDL_LOG_CATEGORY_RESERVED3,
79 SDL_LOG_CATEGORY_RESERVED4,
80 SDL_LOG_CATEGORY_RESERVED5,
81 SDL_LOG_CATEGORY_RESERVED6,
82 SDL_LOG_CATEGORY_RESERVED7,
83 SDL_LOG_CATEGORY_RESERVED8,
84 SDL_LOG_CATEGORY_RESERVED9,
85 SDL_LOG_CATEGORY_RESERVED10,
87 /* Beyond this point is reserved for application use, e.g.
89 MYAPP_CATEGORY_AWESOME1 = SDL_LOG_CATEGORY_CUSTOM,
90 MYAPP_CATEGORY_AWESOME2,
91 MYAPP_CATEGORY_AWESOME3,
95 SDL_LOG_CATEGORY_CUSTOM
99 * \brief The predefined log priorities
103 SDL_LOG_PRIORITY_VERBOSE = 1,
104 SDL_LOG_PRIORITY_DEBUG,
105 SDL_LOG_PRIORITY_INFO,
106 SDL_LOG_PRIORITY_WARN,
107 SDL_LOG_PRIORITY_ERROR,
108 SDL_LOG_PRIORITY_CRITICAL,
109 SDL_NUM_LOG_PRIORITIES
114 * \brief Set the priority of all log categories
116 extern DECLSPEC void SDLCALL SDL_LogSetAllPriority(SDL_LogPriority priority);
119 * \brief Set the priority of a particular log category
121 extern DECLSPEC void SDLCALL SDL_LogSetPriority(int category,
122 SDL_LogPriority priority);
125 * \brief Set the priority of a particular log category
127 extern DECLSPEC SDL_LogPriority SDLCALL SDL_LogGetPriority(int category);
130 * \brief Reset all priorities to default.
132 * \note This is called in SDL_Quit().
134 extern DECLSPEC void SDLCALL SDL_LogResetPriorities(void);
137 * \brief Log a message with SDL_LOG_CATEGORY_APPLICATION and SDL_LOG_PRIORITY_INFO
139 extern DECLSPEC void SDLCALL SDL_Log(const char *fmt, ...);
142 * \brief Log a message with SDL_LOG_PRIORITY_VERBOSE
144 extern DECLSPEC void SDLCALL SDL_LogVerbose(int category, const char *fmt, ...);
147 * \brief Log a message with SDL_LOG_PRIORITY_INFO
149 extern DECLSPEC void SDLCALL SDL_LogInfo(int category, const char *fmt, ...);
152 * \brief Log a message with SDL_LOG_PRIORITY_WARN
154 extern DECLSPEC void SDLCALL SDL_LogWarn(int category, const char *fmt, ...);
157 * \brief Log a message with SDL_LOG_PRIORITY_ERROR
159 extern DECLSPEC void SDLCALL SDL_LogError(int category, const char *fmt, ...);
162 * \brief Log a message with SDL_LOG_PRIORITY_CRITICAL
164 extern DECLSPEC void SDLCALL SDL_LogCritical(int category, const char *fmt, ...);
167 * \brief Log a message with the specified category and priority.
169 extern DECLSPEC void SDLCALL SDL_LogMessage(int category,
170 SDL_LogPriority priority,
171 const char *fmt, ...);
174 * \brief Log a message with the specified category and priority.
176 extern DECLSPEC void SDLCALL SDL_LogMessageV(int category,
177 SDL_LogPriority priority,
178 const char *fmt, va_list ap);
181 * \brief The prototype for the log output function
183 typedef void (*SDL_LogOutputFunction)(void *userdata, int category, SDL_LogPriority priority, const char *message);
186 * \brief Get the current log output function.
188 extern DECLSPEC void SDLCALL SDL_LogGetOutputFunction(SDL_LogOutputFunction *callback, void **userdata);
191 * \brief This function allows you to replace the default log output
192 * function with one of your own.
194 extern DECLSPEC void SDLCALL SDL_LogSetOutputFunction(SDL_LogOutputFunction callback, void *userdata);
197 /* Ends C function definitions when using C++ */
203 #include "close_code.h"
205 #endif /* _SDL_log_h */
207 /* vi: set ts=4 sw=4 expandtab: */