Mercurial > sdl-ios-xcode
comparison include/SDL_log.h @ 5226:2ee8112bfc6b
Added a simple log message API
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 07 Feb 2011 16:45:40 -0800 |
parents | |
children | 1e28342cb15d |
comparison
equal
deleted
inserted
replaced
5225:1fbe1c202501 | 5226:2ee8112bfc6b |
---|---|
1 /* | |
2 SDL - Simple DirectMedia Layer | |
3 Copyright (C) 1997-2010 Sam Lantinga | |
4 | |
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. | |
9 | |
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. | |
14 | |
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 | |
18 | |
19 Sam Lantinga | |
20 slouken@libsdl.org | |
21 */ | |
22 | |
23 /** | |
24 * \file SDL_log.h | |
25 * | |
26 * Simple log messages with categories and priorities. | |
27 * | |
28 * By default logs are quiet, but if you're debugging SDL you might want: | |
29 * | |
30 * SDL_LogSetAllPriority(SDL_LOG_PRIORITY_WARN); | |
31 * | |
32 * Here's where the messages go on different platforms: | |
33 * Windows: debug output stream | |
34 * Android: log output | |
35 * Others: standard error output (stderr) | |
36 */ | |
37 | |
38 #ifndef _SDL_log_h | |
39 #define _SDL_log_h | |
40 | |
41 #include "SDL_stdinc.h" | |
42 | |
43 #include "begin_code.h" | |
44 /* Set up for C function definitions, even when using C++ */ | |
45 #ifdef __cplusplus | |
46 /* *INDENT-OFF* */ | |
47 extern "C" { | |
48 /* *INDENT-ON* */ | |
49 #endif | |
50 | |
51 | |
52 /** | |
53 * \brief The maximum size of a log message | |
54 * | |
55 * Messages longer than the maximum size will be truncated | |
56 */ | |
57 #define SDL_MAX_LOG_MESSAGE 4096 | |
58 | |
59 /** | |
60 * \brief The predefined log categories | |
61 * | |
62 * By default the application category is enabled at the INFO level, | |
63 * and all other categories are enabled at the CRITICAL level. | |
64 */ | |
65 enum | |
66 { | |
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, | |
74 | |
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, | |
86 | |
87 /* Beyond this point is reserved for application use, e.g. | |
88 enum { | |
89 MYAPP_CATEGORY_AWESOME1 = SDL_LOG_CATEGORY_CUSTOM, | |
90 MYAPP_CATEGORY_AWESOME2, | |
91 MYAPP_CATEGORY_AWESOME3, | |
92 ... | |
93 }; | |
94 */ | |
95 SDL_LOG_CATEGORY_CUSTOM, | |
96 }; | |
97 | |
98 /** | |
99 * \brief The predefined log priorities | |
100 */ | |
101 typedef enum | |
102 { | |
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 | |
110 } SDL_LogPriority; | |
111 | |
112 | |
113 /** | |
114 * \brief Set the priority of all log categories | |
115 */ | |
116 extern DECLSPEC void SDLCALL SDL_LogSetAllPriority(SDL_LogPriority priority); | |
117 | |
118 /** | |
119 * \brief Set the priority of a particular log category | |
120 */ | |
121 extern DECLSPEC void SDLCALL SDL_LogSetPriority(int category, | |
122 SDL_LogPriority priority); | |
123 | |
124 /** | |
125 * \brief Set the priority of a particular log category | |
126 */ | |
127 extern DECLSPEC SDL_LogPriority SDLCALL SDL_LogGetPriority(int category); | |
128 | |
129 /** | |
130 * \brief Reset all priorities to default. | |
131 * | |
132 * \note This is called in SDL_Quit(). | |
133 */ | |
134 extern DECLSPEC void SDLCALL SDL_LogResetPriorities(void); | |
135 | |
136 /** | |
137 * \brief Log a message with SDL_LOG_CATEGORY_APPLICATION and SDL_LOG_PRIORITY_INFO | |
138 */ | |
139 extern DECLSPEC void SDLCALL SDL_Log(const char *fmt, ...); | |
140 | |
141 /** | |
142 * \brief Log a message with SDL_LOG_PRIORITY_VERBOSE | |
143 */ | |
144 extern DECLSPEC void SDLCALL SDL_LogVerbose(int category, const char *fmt, ...); | |
145 | |
146 /** | |
147 * \brief Log a message with SDL_LOG_PRIORITY_INFO | |
148 */ | |
149 extern DECLSPEC void SDLCALL SDL_LogInfo(int category, const char *fmt, ...); | |
150 | |
151 /** | |
152 * \brief Log a message with SDL_LOG_PRIORITY_WARN | |
153 */ | |
154 extern DECLSPEC void SDLCALL SDL_LogWarn(int category, const char *fmt, ...); | |
155 | |
156 /** | |
157 * \brief Log a message with SDL_LOG_PRIORITY_ERROR | |
158 */ | |
159 extern DECLSPEC void SDLCALL SDL_LogError(int category, const char *fmt, ...); | |
160 | |
161 /** | |
162 * \brief Log a message with SDL_LOG_PRIORITY_CRITICAL | |
163 */ | |
164 extern DECLSPEC void SDLCALL SDL_LogCritical(int category, const char *fmt, ...); | |
165 | |
166 /** | |
167 * \brief Log a message with the specified category and priority. | |
168 */ | |
169 extern DECLSPEC void SDLCALL SDL_LogMessage(int category, | |
170 SDL_LogPriority priority, | |
171 const char *fmt, ...); | |
172 | |
173 /** | |
174 * \brief Log a message with the specified category and priority. | |
175 */ | |
176 extern DECLSPEC void SDLCALL SDL_LogMessageV(int category, | |
177 SDL_LogPriority priority, | |
178 const char *fmt, va_list ap); | |
179 | |
180 | |
181 /* Ends C function definitions when using C++ */ | |
182 #ifdef __cplusplus | |
183 /* *INDENT-OFF* */ | |
184 } | |
185 /* *INDENT-ON* */ | |
186 #endif | |
187 #include "close_code.h" | |
188 | |
189 #endif /* _SDL_log_h */ | |
190 | |
191 /* vi: set ts=4 sw=4 expandtab: */ |