diff options
Diffstat (limited to 'contrib/SDL-3.2.8/include/SDL3/SDL_log.h')
| -rw-r--r-- | contrib/SDL-3.2.8/include/SDL3/SDL_log.h | 538 |
1 files changed, 538 insertions, 0 deletions
diff --git a/contrib/SDL-3.2.8/include/SDL3/SDL_log.h b/contrib/SDL-3.2.8/include/SDL3/SDL_log.h new file mode 100644 index 0000000..3fd7ec2 --- /dev/null +++ b/contrib/SDL-3.2.8/include/SDL3/SDL_log.h | |||
| @@ -0,0 +1,538 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 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. | ||
| 8 | |||
| 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: | ||
| 12 | |||
| 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. | ||
| 20 | */ | ||
| 21 | |||
| 22 | /** | ||
| 23 | * # CategoryLog | ||
| 24 | * | ||
| 25 | * Simple log messages with priorities and categories. A message's | ||
| 26 | * SDL_LogPriority signifies how important the message is. A message's | ||
| 27 | * SDL_LogCategory signifies from what domain it belongs to. Every category | ||
| 28 | * has a minimum priority specified: when a message belongs to that category, | ||
| 29 | * it will only be sent out if it has that minimum priority or higher. | ||
| 30 | * | ||
| 31 | * SDL's own logs are sent below the default priority threshold, so they are | ||
| 32 | * quiet by default. | ||
| 33 | * | ||
| 34 | * You can change the log verbosity programmatically using | ||
| 35 | * SDL_SetLogPriority() or with SDL_SetHint(SDL_HINT_LOGGING, ...), or with | ||
| 36 | * the "SDL_LOGGING" environment variable. This variable is a comma separated | ||
| 37 | * set of category=level tokens that define the default logging levels for SDL | ||
| 38 | * applications. | ||
| 39 | * | ||
| 40 | * The category can be a numeric category, one of "app", "error", "assert", | ||
| 41 | * "system", "audio", "video", "render", "input", "test", or `*` for any | ||
| 42 | * unspecified category. | ||
| 43 | * | ||
| 44 | * The level can be a numeric level, one of "trace", "verbose", "debug", | ||
| 45 | * "info", "warn", "error", "critical", or "quiet" to disable that category. | ||
| 46 | * | ||
| 47 | * You can omit the category if you want to set the logging level for all | ||
| 48 | * categories. | ||
| 49 | * | ||
| 50 | * If this hint isn't set, the default log levels are equivalent to: | ||
| 51 | * | ||
| 52 | * `app=info,assert=warn,test=verbose,*=error` | ||
| 53 | * | ||
| 54 | * Here's where the messages go on different platforms: | ||
| 55 | * | ||
| 56 | * - Windows: debug output stream | ||
| 57 | * - Android: log output | ||
| 58 | * - Others: standard error output (stderr) | ||
| 59 | * | ||
| 60 | * You don't need to have a newline (`\n`) on the end of messages, the | ||
| 61 | * functions will do that for you. For consistent behavior cross-platform, you | ||
| 62 | * shouldn't have any newlines in messages, such as to log multiple lines in | ||
| 63 | * one call; unusual platform-specific behavior can be observed in such usage. | ||
| 64 | * Do one log call per line instead, with no newlines in messages. | ||
| 65 | * | ||
| 66 | * Each log call is atomic, so you won't see log messages cut off one another | ||
| 67 | * when logging from multiple threads. | ||
| 68 | */ | ||
| 69 | |||
| 70 | #ifndef SDL_log_h_ | ||
| 71 | #define SDL_log_h_ | ||
| 72 | |||
| 73 | #include <SDL3/SDL_stdinc.h> | ||
| 74 | |||
| 75 | #include <SDL3/SDL_begin_code.h> | ||
| 76 | /* Set up for C function definitions, even when using C++ */ | ||
| 77 | #ifdef __cplusplus | ||
| 78 | extern "C" { | ||
| 79 | #endif | ||
| 80 | |||
| 81 | /** | ||
| 82 | * The predefined log categories | ||
| 83 | * | ||
| 84 | * By default the application and gpu categories are enabled at the INFO | ||
| 85 | * level, the assert category is enabled at the WARN level, test is enabled at | ||
| 86 | * the VERBOSE level and all other categories are enabled at the ERROR level. | ||
| 87 | * | ||
| 88 | * \since This enum is available since SDL 3.2.0. | ||
| 89 | */ | ||
| 90 | typedef enum SDL_LogCategory | ||
| 91 | { | ||
| 92 | SDL_LOG_CATEGORY_APPLICATION, | ||
| 93 | SDL_LOG_CATEGORY_ERROR, | ||
| 94 | SDL_LOG_CATEGORY_ASSERT, | ||
| 95 | SDL_LOG_CATEGORY_SYSTEM, | ||
| 96 | SDL_LOG_CATEGORY_AUDIO, | ||
| 97 | SDL_LOG_CATEGORY_VIDEO, | ||
| 98 | SDL_LOG_CATEGORY_RENDER, | ||
| 99 | SDL_LOG_CATEGORY_INPUT, | ||
| 100 | SDL_LOG_CATEGORY_TEST, | ||
| 101 | SDL_LOG_CATEGORY_GPU, | ||
| 102 | |||
| 103 | /* Reserved for future SDL library use */ | ||
| 104 | SDL_LOG_CATEGORY_RESERVED2, | ||
| 105 | SDL_LOG_CATEGORY_RESERVED3, | ||
| 106 | SDL_LOG_CATEGORY_RESERVED4, | ||
| 107 | SDL_LOG_CATEGORY_RESERVED5, | ||
| 108 | SDL_LOG_CATEGORY_RESERVED6, | ||
| 109 | SDL_LOG_CATEGORY_RESERVED7, | ||
| 110 | SDL_LOG_CATEGORY_RESERVED8, | ||
| 111 | SDL_LOG_CATEGORY_RESERVED9, | ||
| 112 | SDL_LOG_CATEGORY_RESERVED10, | ||
| 113 | |||
| 114 | /* Beyond this point is reserved for application use, e.g. | ||
| 115 | enum { | ||
| 116 | MYAPP_CATEGORY_AWESOME1 = SDL_LOG_CATEGORY_CUSTOM, | ||
| 117 | MYAPP_CATEGORY_AWESOME2, | ||
| 118 | MYAPP_CATEGORY_AWESOME3, | ||
| 119 | ... | ||
| 120 | }; | ||
| 121 | */ | ||
| 122 | SDL_LOG_CATEGORY_CUSTOM | ||
| 123 | } SDL_LogCategory; | ||
| 124 | |||
| 125 | /** | ||
| 126 | * The predefined log priorities | ||
| 127 | * | ||
| 128 | * \since This enum is available since SDL 3.2.0. | ||
| 129 | */ | ||
| 130 | typedef enum SDL_LogPriority | ||
| 131 | { | ||
| 132 | SDL_LOG_PRIORITY_INVALID, | ||
| 133 | SDL_LOG_PRIORITY_TRACE, | ||
| 134 | SDL_LOG_PRIORITY_VERBOSE, | ||
| 135 | SDL_LOG_PRIORITY_DEBUG, | ||
| 136 | SDL_LOG_PRIORITY_INFO, | ||
| 137 | SDL_LOG_PRIORITY_WARN, | ||
| 138 | SDL_LOG_PRIORITY_ERROR, | ||
| 139 | SDL_LOG_PRIORITY_CRITICAL, | ||
| 140 | SDL_LOG_PRIORITY_COUNT | ||
| 141 | } SDL_LogPriority; | ||
| 142 | |||
| 143 | |||
| 144 | /** | ||
| 145 | * Set the priority of all log categories. | ||
| 146 | * | ||
| 147 | * \param priority the SDL_LogPriority to assign. | ||
| 148 | * | ||
| 149 | * \threadsafety It is safe to call this function from any thread. | ||
| 150 | * | ||
| 151 | * \since This function is available since SDL 3.2.0. | ||
| 152 | * | ||
| 153 | * \sa SDL_ResetLogPriorities | ||
| 154 | * \sa SDL_SetLogPriority | ||
| 155 | */ | ||
| 156 | extern SDL_DECLSPEC void SDLCALL SDL_SetLogPriorities(SDL_LogPriority priority); | ||
| 157 | |||
| 158 | /** | ||
| 159 | * Set the priority of a particular log category. | ||
| 160 | * | ||
| 161 | * \param category the category to assign a priority to. | ||
| 162 | * \param priority the SDL_LogPriority to assign. | ||
| 163 | * | ||
| 164 | * \threadsafety It is safe to call this function from any thread. | ||
| 165 | * | ||
| 166 | * \since This function is available since SDL 3.2.0. | ||
| 167 | * | ||
| 168 | * \sa SDL_GetLogPriority | ||
| 169 | * \sa SDL_ResetLogPriorities | ||
| 170 | * \sa SDL_SetLogPriorities | ||
| 171 | */ | ||
| 172 | extern SDL_DECLSPEC void SDLCALL SDL_SetLogPriority(int category, SDL_LogPriority priority); | ||
| 173 | |||
| 174 | /** | ||
| 175 | * Get the priority of a particular log category. | ||
| 176 | * | ||
| 177 | * \param category the category to query. | ||
| 178 | * \returns the SDL_LogPriority for the requested category. | ||
| 179 | * | ||
| 180 | * \threadsafety It is safe to call this function from any thread. | ||
| 181 | * | ||
| 182 | * \since This function is available since SDL 3.2.0. | ||
| 183 | * | ||
| 184 | * \sa SDL_SetLogPriority | ||
| 185 | */ | ||
| 186 | extern SDL_DECLSPEC SDL_LogPriority SDLCALL SDL_GetLogPriority(int category); | ||
| 187 | |||
| 188 | /** | ||
| 189 | * Reset all priorities to default. | ||
| 190 | * | ||
| 191 | * This is called by SDL_Quit(). | ||
| 192 | * | ||
| 193 | * \threadsafety It is safe to call this function from any thread. | ||
| 194 | * | ||
| 195 | * \since This function is available since SDL 3.2.0. | ||
| 196 | * | ||
| 197 | * \sa SDL_SetLogPriorities | ||
| 198 | * \sa SDL_SetLogPriority | ||
| 199 | */ | ||
| 200 | extern SDL_DECLSPEC void SDLCALL SDL_ResetLogPriorities(void); | ||
| 201 | |||
| 202 | /** | ||
| 203 | * Set the text prepended to log messages of a given priority. | ||
| 204 | * | ||
| 205 | * By default SDL_LOG_PRIORITY_INFO and below have no prefix, and | ||
| 206 | * SDL_LOG_PRIORITY_WARN and higher have a prefix showing their priority, e.g. | ||
| 207 | * "WARNING: ". | ||
| 208 | * | ||
| 209 | * \param priority the SDL_LogPriority to modify. | ||
| 210 | * \param prefix the prefix to use for that log priority, or NULL to use no | ||
| 211 | * prefix. | ||
| 212 | * \returns true on success or false on failure; call SDL_GetError() for more | ||
| 213 | * information. | ||
| 214 | * | ||
| 215 | * \threadsafety It is safe to call this function from any thread. | ||
| 216 | * | ||
| 217 | * \since This function is available since SDL 3.2.0. | ||
| 218 | * | ||
| 219 | * \sa SDL_SetLogPriorities | ||
| 220 | * \sa SDL_SetLogPriority | ||
| 221 | */ | ||
| 222 | extern SDL_DECLSPEC bool SDLCALL SDL_SetLogPriorityPrefix(SDL_LogPriority priority, const char *prefix); | ||
| 223 | |||
| 224 | /** | ||
| 225 | * Log a message with SDL_LOG_CATEGORY_APPLICATION and SDL_LOG_PRIORITY_INFO. | ||
| 226 | * | ||
| 227 | * \param fmt a printf() style message format string. | ||
| 228 | * \param ... additional parameters matching % tokens in the `fmt` string, if | ||
| 229 | * any. | ||
| 230 | * | ||
| 231 | * \threadsafety It is safe to call this function from any thread. | ||
| 232 | * | ||
| 233 | * \since This function is available since SDL 3.2.0. | ||
| 234 | * | ||
| 235 | * \sa SDL_LogCritical | ||
| 236 | * \sa SDL_LogDebug | ||
| 237 | * \sa SDL_LogError | ||
| 238 | * \sa SDL_LogInfo | ||
| 239 | * \sa SDL_LogMessage | ||
| 240 | * \sa SDL_LogMessageV | ||
| 241 | * \sa SDL_LogTrace | ||
| 242 | * \sa SDL_LogVerbose | ||
| 243 | * \sa SDL_LogWarn | ||
| 244 | */ | ||
| 245 | extern SDL_DECLSPEC void SDLCALL SDL_Log(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1); | ||
| 246 | |||
| 247 | /** | ||
| 248 | * Log a message with SDL_LOG_PRIORITY_TRACE. | ||
| 249 | * | ||
| 250 | * \param category the category of the message. | ||
| 251 | * \param fmt a printf() style message format string. | ||
| 252 | * \param ... additional parameters matching % tokens in the **fmt** string, | ||
| 253 | * if any. | ||
| 254 | * | ||
| 255 | * \threadsafety It is safe to call this function from any thread. | ||
| 256 | * | ||
| 257 | * \since This function is available since SDL 3.2.0. | ||
| 258 | * | ||
| 259 | * \sa SDL_Log | ||
| 260 | * \sa SDL_LogCritical | ||
| 261 | * \sa SDL_LogDebug | ||
| 262 | * \sa SDL_LogError | ||
| 263 | * \sa SDL_LogInfo | ||
| 264 | * \sa SDL_LogMessage | ||
| 265 | * \sa SDL_LogMessageV | ||
| 266 | * \sa SDL_LogTrace | ||
| 267 | * \sa SDL_LogVerbose | ||
| 268 | * \sa SDL_LogWarn | ||
| 269 | */ | ||
| 270 | extern SDL_DECLSPEC void SDLCALL SDL_LogTrace(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2); | ||
| 271 | |||
| 272 | /** | ||
| 273 | * Log a message with SDL_LOG_PRIORITY_VERBOSE. | ||
| 274 | * | ||
| 275 | * \param category the category of the message. | ||
| 276 | * \param fmt a printf() style message format string. | ||
| 277 | * \param ... additional parameters matching % tokens in the **fmt** string, | ||
| 278 | * if any. | ||
| 279 | * | ||
| 280 | * \threadsafety It is safe to call this function from any thread. | ||
| 281 | * | ||
| 282 | * \since This function is available since SDL 3.2.0. | ||
| 283 | * | ||
| 284 | * \sa SDL_Log | ||
| 285 | * \sa SDL_LogCritical | ||
| 286 | * \sa SDL_LogDebug | ||
| 287 | * \sa SDL_LogError | ||
| 288 | * \sa SDL_LogInfo | ||
| 289 | * \sa SDL_LogMessage | ||
| 290 | * \sa SDL_LogMessageV | ||
| 291 | * \sa SDL_LogWarn | ||
| 292 | */ | ||
| 293 | extern SDL_DECLSPEC void SDLCALL SDL_LogVerbose(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2); | ||
| 294 | |||
| 295 | /** | ||
| 296 | * Log a message with SDL_LOG_PRIORITY_DEBUG. | ||
| 297 | * | ||
| 298 | * \param category the category of the message. | ||
| 299 | * \param fmt a printf() style message format string. | ||
| 300 | * \param ... additional parameters matching % tokens in the **fmt** string, | ||
| 301 | * if any. | ||
| 302 | * | ||
| 303 | * \threadsafety It is safe to call this function from any thread. | ||
| 304 | * | ||
| 305 | * \since This function is available since SDL 3.2.0. | ||
| 306 | * | ||
| 307 | * \sa SDL_Log | ||
| 308 | * \sa SDL_LogCritical | ||
| 309 | * \sa SDL_LogError | ||
| 310 | * \sa SDL_LogInfo | ||
| 311 | * \sa SDL_LogMessage | ||
| 312 | * \sa SDL_LogMessageV | ||
| 313 | * \sa SDL_LogTrace | ||
| 314 | * \sa SDL_LogVerbose | ||
| 315 | * \sa SDL_LogWarn | ||
| 316 | */ | ||
| 317 | extern SDL_DECLSPEC void SDLCALL SDL_LogDebug(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2); | ||
| 318 | |||
| 319 | /** | ||
| 320 | * Log a message with SDL_LOG_PRIORITY_INFO. | ||
| 321 | * | ||
| 322 | * \param category the category of the message. | ||
| 323 | * \param fmt a printf() style message format string. | ||
| 324 | * \param ... additional parameters matching % tokens in the **fmt** string, | ||
| 325 | * if any. | ||
| 326 | * | ||
| 327 | * \threadsafety It is safe to call this function from any thread. | ||
| 328 | * | ||
| 329 | * \since This function is available since SDL 3.2.0. | ||
| 330 | * | ||
| 331 | * \sa SDL_Log | ||
| 332 | * \sa SDL_LogCritical | ||
| 333 | * \sa SDL_LogDebug | ||
| 334 | * \sa SDL_LogError | ||
| 335 | * \sa SDL_LogMessage | ||
| 336 | * \sa SDL_LogMessageV | ||
| 337 | * \sa SDL_LogTrace | ||
| 338 | * \sa SDL_LogVerbose | ||
| 339 | * \sa SDL_LogWarn | ||
| 340 | */ | ||
| 341 | extern SDL_DECLSPEC void SDLCALL SDL_LogInfo(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2); | ||
| 342 | |||
| 343 | /** | ||
| 344 | * Log a message with SDL_LOG_PRIORITY_WARN. | ||
| 345 | * | ||
| 346 | * \param category the category of the message. | ||
| 347 | * \param fmt a printf() style message format string. | ||
| 348 | * \param ... additional parameters matching % tokens in the **fmt** string, | ||
| 349 | * if any. | ||
| 350 | * | ||
| 351 | * \threadsafety It is safe to call this function from any thread. | ||
| 352 | * | ||
| 353 | * \since This function is available since SDL 3.2.0. | ||
| 354 | * | ||
| 355 | * \sa SDL_Log | ||
| 356 | * \sa SDL_LogCritical | ||
| 357 | * \sa SDL_LogDebug | ||
| 358 | * \sa SDL_LogError | ||
| 359 | * \sa SDL_LogInfo | ||
| 360 | * \sa SDL_LogMessage | ||
| 361 | * \sa SDL_LogMessageV | ||
| 362 | * \sa SDL_LogTrace | ||
| 363 | * \sa SDL_LogVerbose | ||
| 364 | */ | ||
| 365 | extern SDL_DECLSPEC void SDLCALL SDL_LogWarn(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2); | ||
| 366 | |||
| 367 | /** | ||
| 368 | * Log a message with SDL_LOG_PRIORITY_ERROR. | ||
| 369 | * | ||
| 370 | * \param category the category of the message. | ||
| 371 | * \param fmt a printf() style message format string. | ||
| 372 | * \param ... additional parameters matching % tokens in the **fmt** string, | ||
| 373 | * if any. | ||
| 374 | * | ||
| 375 | * \threadsafety It is safe to call this function from any thread. | ||
| 376 | * | ||
| 377 | * \since This function is available since SDL 3.2.0. | ||
| 378 | * | ||
| 379 | * \sa SDL_Log | ||
| 380 | * \sa SDL_LogCritical | ||
| 381 | * \sa SDL_LogDebug | ||
| 382 | * \sa SDL_LogInfo | ||
| 383 | * \sa SDL_LogMessage | ||
| 384 | * \sa SDL_LogMessageV | ||
| 385 | * \sa SDL_LogTrace | ||
| 386 | * \sa SDL_LogVerbose | ||
| 387 | * \sa SDL_LogWarn | ||
| 388 | */ | ||
| 389 | extern SDL_DECLSPEC void SDLCALL SDL_LogError(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2); | ||
| 390 | |||
| 391 | /** | ||
| 392 | * Log a message with SDL_LOG_PRIORITY_CRITICAL. | ||
| 393 | * | ||
| 394 | * \param category the category of the message. | ||
| 395 | * \param fmt a printf() style message format string. | ||
| 396 | * \param ... additional parameters matching % tokens in the **fmt** string, | ||
| 397 | * if any. | ||
| 398 | * | ||
| 399 | * \threadsafety It is safe to call this function from any thread. | ||
| 400 | * | ||
| 401 | * \since This function is available since SDL 3.2.0. | ||
| 402 | * | ||
| 403 | * \sa SDL_Log | ||
| 404 | * \sa SDL_LogDebug | ||
| 405 | * \sa SDL_LogError | ||
| 406 | * \sa SDL_LogInfo | ||
| 407 | * \sa SDL_LogMessage | ||
| 408 | * \sa SDL_LogMessageV | ||
| 409 | * \sa SDL_LogTrace | ||
| 410 | * \sa SDL_LogVerbose | ||
| 411 | * \sa SDL_LogWarn | ||
| 412 | */ | ||
| 413 | extern SDL_DECLSPEC void SDLCALL SDL_LogCritical(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2); | ||
| 414 | |||
| 415 | /** | ||
| 416 | * Log a message with the specified category and priority. | ||
| 417 | * | ||
| 418 | * \param category the category of the message. | ||
| 419 | * \param priority the priority of the message. | ||
| 420 | * \param fmt a printf() style message format string. | ||
| 421 | * \param ... additional parameters matching % tokens in the **fmt** string, | ||
| 422 | * if any. | ||
| 423 | * | ||
| 424 | * \threadsafety It is safe to call this function from any thread. | ||
| 425 | * | ||
| 426 | * \since This function is available since SDL 3.2.0. | ||
| 427 | * | ||
| 428 | * \sa SDL_Log | ||
| 429 | * \sa SDL_LogCritical | ||
| 430 | * \sa SDL_LogDebug | ||
| 431 | * \sa SDL_LogError | ||
| 432 | * \sa SDL_LogInfo | ||
| 433 | * \sa SDL_LogMessageV | ||
| 434 | * \sa SDL_LogTrace | ||
| 435 | * \sa SDL_LogVerbose | ||
| 436 | * \sa SDL_LogWarn | ||
| 437 | */ | ||
| 438 | extern SDL_DECLSPEC void SDLCALL SDL_LogMessage(int category, | ||
| 439 | SDL_LogPriority priority, | ||
| 440 | SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(3); | ||
| 441 | |||
| 442 | /** | ||
| 443 | * Log a message with the specified category and priority. | ||
| 444 | * | ||
| 445 | * \param category the category of the message. | ||
| 446 | * \param priority the priority of the message. | ||
| 447 | * \param fmt a printf() style message format string. | ||
| 448 | * \param ap a variable argument list. | ||
| 449 | * | ||
| 450 | * \threadsafety It is safe to call this function from any thread. | ||
| 451 | * | ||
| 452 | * \since This function is available since SDL 3.2.0. | ||
| 453 | * | ||
| 454 | * \sa SDL_Log | ||
| 455 | * \sa SDL_LogCritical | ||
| 456 | * \sa SDL_LogDebug | ||
| 457 | * \sa SDL_LogError | ||
| 458 | * \sa SDL_LogInfo | ||
| 459 | * \sa SDL_LogMessage | ||
| 460 | * \sa SDL_LogTrace | ||
| 461 | * \sa SDL_LogVerbose | ||
| 462 | * \sa SDL_LogWarn | ||
| 463 | */ | ||
| 464 | extern SDL_DECLSPEC void SDLCALL SDL_LogMessageV(int category, | ||
| 465 | SDL_LogPriority priority, | ||
| 466 | SDL_PRINTF_FORMAT_STRING const char *fmt, va_list ap) SDL_PRINTF_VARARG_FUNCV(3); | ||
| 467 | |||
| 468 | /** | ||
| 469 | * The prototype for the log output callback function. | ||
| 470 | * | ||
| 471 | * This function is called by SDL when there is new text to be logged. A mutex | ||
| 472 | * is held so that this function is never called by more than one thread at | ||
| 473 | * once. | ||
| 474 | * | ||
| 475 | * \param userdata what was passed as `userdata` to | ||
| 476 | * SDL_SetLogOutputFunction(). | ||
| 477 | * \param category the category of the message. | ||
| 478 | * \param priority the priority of the message. | ||
| 479 | * \param message the message being output. | ||
| 480 | * | ||
| 481 | * \since This datatype is available since SDL 3.2.0. | ||
| 482 | */ | ||
| 483 | typedef void (SDLCALL *SDL_LogOutputFunction)(void *userdata, int category, SDL_LogPriority priority, const char *message); | ||
| 484 | |||
| 485 | /** | ||
| 486 | * Get the default log output function. | ||
| 487 | * | ||
| 488 | * \returns the default log output callback. | ||
| 489 | * | ||
| 490 | * \threadsafety It is safe to call this function from any thread. | ||
| 491 | * | ||
| 492 | * \since This function is available since SDL 3.2.0. | ||
| 493 | * | ||
| 494 | * \sa SDL_SetLogOutputFunction | ||
| 495 | * \sa SDL_GetLogOutputFunction | ||
| 496 | */ | ||
| 497 | extern SDL_DECLSPEC SDL_LogOutputFunction SDLCALL SDL_GetDefaultLogOutputFunction(void); | ||
| 498 | |||
| 499 | /** | ||
| 500 | * Get the current log output function. | ||
| 501 | * | ||
| 502 | * \param callback an SDL_LogOutputFunction filled in with the current log | ||
| 503 | * callback. | ||
| 504 | * \param userdata a pointer filled in with the pointer that is passed to | ||
| 505 | * `callback`. | ||
| 506 | * | ||
| 507 | * \threadsafety It is safe to call this function from any thread. | ||
| 508 | * | ||
| 509 | * \since This function is available since SDL 3.2.0. | ||
| 510 | * | ||
| 511 | * \sa SDL_GetDefaultLogOutputFunction | ||
| 512 | * \sa SDL_SetLogOutputFunction | ||
| 513 | */ | ||
| 514 | extern SDL_DECLSPEC void SDLCALL SDL_GetLogOutputFunction(SDL_LogOutputFunction *callback, void **userdata); | ||
| 515 | |||
| 516 | /** | ||
| 517 | * Replace the default log output function with one of your own. | ||
| 518 | * | ||
| 519 | * \param callback an SDL_LogOutputFunction to call instead of the default. | ||
| 520 | * \param userdata a pointer that is passed to `callback`. | ||
| 521 | * | ||
| 522 | * \threadsafety It is safe to call this function from any thread. | ||
| 523 | * | ||
| 524 | * \since This function is available since SDL 3.2.0. | ||
| 525 | * | ||
| 526 | * \sa SDL_GetDefaultLogOutputFunction | ||
| 527 | * \sa SDL_GetLogOutputFunction | ||
| 528 | */ | ||
| 529 | extern SDL_DECLSPEC void SDLCALL SDL_SetLogOutputFunction(SDL_LogOutputFunction callback, void *userdata); | ||
| 530 | |||
| 531 | |||
| 532 | /* Ends C function definitions when using C++ */ | ||
| 533 | #ifdef __cplusplus | ||
| 534 | } | ||
| 535 | #endif | ||
| 536 | #include <SDL3/SDL_close_code.h> | ||
| 537 | |||
| 538 | #endif /* SDL_log_h_ */ | ||
