sdl3_sys/generated/log.rs
1//! Simple log messages with priorities and categories. A message's
2//! [`SDL_LogPriority`] signifies how important the message is. A message's
3//! [`SDL_LogCategory`] signifies from what domain it belongs to. Every category
4//! has a minimum priority specified: when a message belongs to that category,
5//! it will only be sent out if it has that minimum priority or higher.
6//!
7//! SDL's own logs are sent below the default priority threshold, so they are
8//! quiet by default.
9//!
10//! You can change the log verbosity programmatically using
11//! [`SDL_SetLogPriority()`] or with SDL_SetHint([`SDL_HINT_LOGGING`], ...), or with
12//! the "SDL_LOGGING" environment variable. This variable is a comma separated
13//! set of category=level tokens that define the default logging levels for SDL
14//! applications.
15//!
16//! The category can be a numeric category, one of "app", "error", "assert",
17//! "system", "audio", "video", "render", "input", "test", or `*` for any
18//! unspecified category.
19//!
20//! The level can be a numeric level, one of "trace", "verbose", "debug",
21//! "info", "warn", "error", "critical", or "quiet" to disable that category.
22//!
23//! You can omit the category if you want to set the logging level for all
24//! categories.
25//!
26//! If this hint isn't set, the default log levels are equivalent to:
27//!
28//! `app=info,assert=warn,test=verbose,*=error`
29//!
30//! Here's where the messages go on different platforms:
31//!
32//! - Windows: debug output stream
33//! - Android: log output
34//! - Others: standard error output (stderr)
35//!
36//! You don't need to have a newline (`\n`) on the end of messages, the
37//! functions will do that for you. For consistent behavior cross-platform, you
38//! shouldn't have any newlines in messages, such as to log multiple lines in
39//! one call; unusual platform-specific behavior can be observed in such usage.
40//! Do one log call per line instead, with no newlines in messages.
41//!
42//! Each log call is atomic, so you won't see log messages cut off one another
43//! when logging from multiple threads.
44
45use super::stdinc::*;
46
47/// The predefined log categories
48///
49/// By default the application and gpu categories are enabled at the INFO
50/// level, the assert category is enabled at the WARN level, test is enabled at
51/// the VERBOSE level and all other categories are enabled at the ERROR level.
52///
53/// ### Availability
54/// This enum is available since SDL 3.2.0.
55///
56/// ### Known values (`sdl3-sys`)
57/// | Associated constant | Global constant | Description |
58/// | ------------------- | --------------- | ----------- |
59/// | [`APPLICATION`](SDL_LogCategory::APPLICATION) | [`SDL_LOG_CATEGORY_APPLICATION`] | |
60/// | [`ERROR`](SDL_LogCategory::ERROR) | [`SDL_LOG_CATEGORY_ERROR`] | |
61/// | [`ASSERT`](SDL_LogCategory::ASSERT) | [`SDL_LOG_CATEGORY_ASSERT`] | |
62/// | [`SYSTEM`](SDL_LogCategory::SYSTEM) | [`SDL_LOG_CATEGORY_SYSTEM`] | |
63/// | [`AUDIO`](SDL_LogCategory::AUDIO) | [`SDL_LOG_CATEGORY_AUDIO`] | |
64/// | [`VIDEO`](SDL_LogCategory::VIDEO) | [`SDL_LOG_CATEGORY_VIDEO`] | |
65/// | [`RENDER`](SDL_LogCategory::RENDER) | [`SDL_LOG_CATEGORY_RENDER`] | |
66/// | [`INPUT`](SDL_LogCategory::INPUT) | [`SDL_LOG_CATEGORY_INPUT`] | |
67/// | [`TEST`](SDL_LogCategory::TEST) | [`SDL_LOG_CATEGORY_TEST`] | |
68/// | [`GPU`](SDL_LogCategory::GPU) | [`SDL_LOG_CATEGORY_GPU`] | |
69/// | [`RESERVED2`](SDL_LogCategory::RESERVED2) | [`SDL_LOG_CATEGORY_RESERVED2`] | |
70/// | [`RESERVED3`](SDL_LogCategory::RESERVED3) | [`SDL_LOG_CATEGORY_RESERVED3`] | |
71/// | [`RESERVED4`](SDL_LogCategory::RESERVED4) | [`SDL_LOG_CATEGORY_RESERVED4`] | |
72/// | [`RESERVED5`](SDL_LogCategory::RESERVED5) | [`SDL_LOG_CATEGORY_RESERVED5`] | |
73/// | [`RESERVED6`](SDL_LogCategory::RESERVED6) | [`SDL_LOG_CATEGORY_RESERVED6`] | |
74/// | [`RESERVED7`](SDL_LogCategory::RESERVED7) | [`SDL_LOG_CATEGORY_RESERVED7`] | |
75/// | [`RESERVED8`](SDL_LogCategory::RESERVED8) | [`SDL_LOG_CATEGORY_RESERVED8`] | |
76/// | [`RESERVED9`](SDL_LogCategory::RESERVED9) | [`SDL_LOG_CATEGORY_RESERVED9`] | |
77/// | [`RESERVED10`](SDL_LogCategory::RESERVED10) | [`SDL_LOG_CATEGORY_RESERVED10`] | |
78/// | [`CUSTOM`](SDL_LogCategory::CUSTOM) | [`SDL_LOG_CATEGORY_CUSTOM`] | |
79#[repr(transparent)]
80#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
81pub struct SDL_LogCategory(pub ::core::ffi::c_int);
82
83impl From<SDL_LogCategory> for ::core::ffi::c_int {
84 #[inline(always)]
85 fn from(value: SDL_LogCategory) -> Self {
86 value.0
87 }
88}
89
90#[cfg(feature = "debug-impls")]
91impl ::core::fmt::Debug for SDL_LogCategory {
92 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
93 #[allow(unreachable_patterns)]
94 f.write_str(match *self {
95 Self::APPLICATION => "SDL_LOG_CATEGORY_APPLICATION",
96 Self::ERROR => "SDL_LOG_CATEGORY_ERROR",
97 Self::ASSERT => "SDL_LOG_CATEGORY_ASSERT",
98 Self::SYSTEM => "SDL_LOG_CATEGORY_SYSTEM",
99 Self::AUDIO => "SDL_LOG_CATEGORY_AUDIO",
100 Self::VIDEO => "SDL_LOG_CATEGORY_VIDEO",
101 Self::RENDER => "SDL_LOG_CATEGORY_RENDER",
102 Self::INPUT => "SDL_LOG_CATEGORY_INPUT",
103 Self::TEST => "SDL_LOG_CATEGORY_TEST",
104 Self::GPU => "SDL_LOG_CATEGORY_GPU",
105 Self::RESERVED2 => "SDL_LOG_CATEGORY_RESERVED2",
106 Self::RESERVED3 => "SDL_LOG_CATEGORY_RESERVED3",
107 Self::RESERVED4 => "SDL_LOG_CATEGORY_RESERVED4",
108 Self::RESERVED5 => "SDL_LOG_CATEGORY_RESERVED5",
109 Self::RESERVED6 => "SDL_LOG_CATEGORY_RESERVED6",
110 Self::RESERVED7 => "SDL_LOG_CATEGORY_RESERVED7",
111 Self::RESERVED8 => "SDL_LOG_CATEGORY_RESERVED8",
112 Self::RESERVED9 => "SDL_LOG_CATEGORY_RESERVED9",
113 Self::RESERVED10 => "SDL_LOG_CATEGORY_RESERVED10",
114 Self::CUSTOM => "SDL_LOG_CATEGORY_CUSTOM",
115
116 _ => return write!(f, "SDL_LogCategory({})", self.0),
117 })
118 }
119}
120
121impl SDL_LogCategory {
122 pub const APPLICATION: Self = Self(0);
123 pub const ERROR: Self = Self(1);
124 pub const ASSERT: Self = Self(2);
125 pub const SYSTEM: Self = Self(3);
126 pub const AUDIO: Self = Self(4);
127 pub const VIDEO: Self = Self(5);
128 pub const RENDER: Self = Self(6);
129 pub const INPUT: Self = Self(7);
130 pub const TEST: Self = Self(8);
131 pub const GPU: Self = Self(9);
132 pub const RESERVED2: Self = Self(10);
133 pub const RESERVED3: Self = Self(11);
134 pub const RESERVED4: Self = Self(12);
135 pub const RESERVED5: Self = Self(13);
136 pub const RESERVED6: Self = Self(14);
137 pub const RESERVED7: Self = Self(15);
138 pub const RESERVED8: Self = Self(16);
139 pub const RESERVED9: Self = Self(17);
140 pub const RESERVED10: Self = Self(18);
141 pub const CUSTOM: Self = Self(19);
142}
143
144pub const SDL_LOG_CATEGORY_APPLICATION: SDL_LogCategory = SDL_LogCategory::APPLICATION;
145pub const SDL_LOG_CATEGORY_ERROR: SDL_LogCategory = SDL_LogCategory::ERROR;
146pub const SDL_LOG_CATEGORY_ASSERT: SDL_LogCategory = SDL_LogCategory::ASSERT;
147pub const SDL_LOG_CATEGORY_SYSTEM: SDL_LogCategory = SDL_LogCategory::SYSTEM;
148pub const SDL_LOG_CATEGORY_AUDIO: SDL_LogCategory = SDL_LogCategory::AUDIO;
149pub const SDL_LOG_CATEGORY_VIDEO: SDL_LogCategory = SDL_LogCategory::VIDEO;
150pub const SDL_LOG_CATEGORY_RENDER: SDL_LogCategory = SDL_LogCategory::RENDER;
151pub const SDL_LOG_CATEGORY_INPUT: SDL_LogCategory = SDL_LogCategory::INPUT;
152pub const SDL_LOG_CATEGORY_TEST: SDL_LogCategory = SDL_LogCategory::TEST;
153pub const SDL_LOG_CATEGORY_GPU: SDL_LogCategory = SDL_LogCategory::GPU;
154pub const SDL_LOG_CATEGORY_RESERVED2: SDL_LogCategory = SDL_LogCategory::RESERVED2;
155pub const SDL_LOG_CATEGORY_RESERVED3: SDL_LogCategory = SDL_LogCategory::RESERVED3;
156pub const SDL_LOG_CATEGORY_RESERVED4: SDL_LogCategory = SDL_LogCategory::RESERVED4;
157pub const SDL_LOG_CATEGORY_RESERVED5: SDL_LogCategory = SDL_LogCategory::RESERVED5;
158pub const SDL_LOG_CATEGORY_RESERVED6: SDL_LogCategory = SDL_LogCategory::RESERVED6;
159pub const SDL_LOG_CATEGORY_RESERVED7: SDL_LogCategory = SDL_LogCategory::RESERVED7;
160pub const SDL_LOG_CATEGORY_RESERVED8: SDL_LogCategory = SDL_LogCategory::RESERVED8;
161pub const SDL_LOG_CATEGORY_RESERVED9: SDL_LogCategory = SDL_LogCategory::RESERVED9;
162pub const SDL_LOG_CATEGORY_RESERVED10: SDL_LogCategory = SDL_LogCategory::RESERVED10;
163pub const SDL_LOG_CATEGORY_CUSTOM: SDL_LogCategory = SDL_LogCategory::CUSTOM;
164
165/// The predefined log priorities
166///
167/// ### Availability
168/// This enum is available since SDL 3.2.0.
169///
170/// ### Known values (`sdl3-sys`)
171/// | Associated constant | Global constant | Description |
172/// | ------------------- | --------------- | ----------- |
173/// | [`INVALID`](SDL_LogPriority::INVALID) | [`SDL_LOG_PRIORITY_INVALID`] | |
174/// | [`TRACE`](SDL_LogPriority::TRACE) | [`SDL_LOG_PRIORITY_TRACE`] | |
175/// | [`VERBOSE`](SDL_LogPriority::VERBOSE) | [`SDL_LOG_PRIORITY_VERBOSE`] | |
176/// | [`DEBUG`](SDL_LogPriority::DEBUG) | [`SDL_LOG_PRIORITY_DEBUG`] | |
177/// | [`INFO`](SDL_LogPriority::INFO) | [`SDL_LOG_PRIORITY_INFO`] | |
178/// | [`WARN`](SDL_LogPriority::WARN) | [`SDL_LOG_PRIORITY_WARN`] | |
179/// | [`ERROR`](SDL_LogPriority::ERROR) | [`SDL_LOG_PRIORITY_ERROR`] | |
180/// | [`CRITICAL`](SDL_LogPriority::CRITICAL) | [`SDL_LOG_PRIORITY_CRITICAL`] | |
181/// | [`COUNT`](SDL_LogPriority::COUNT) | [`SDL_LOG_PRIORITY_COUNT`] | |
182#[repr(transparent)]
183#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
184pub struct SDL_LogPriority(pub ::core::ffi::c_int);
185
186impl From<SDL_LogPriority> for ::core::ffi::c_int {
187 #[inline(always)]
188 fn from(value: SDL_LogPriority) -> Self {
189 value.0
190 }
191}
192
193#[cfg(feature = "debug-impls")]
194impl ::core::fmt::Debug for SDL_LogPriority {
195 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
196 #[allow(unreachable_patterns)]
197 f.write_str(match *self {
198 Self::INVALID => "SDL_LOG_PRIORITY_INVALID",
199 Self::TRACE => "SDL_LOG_PRIORITY_TRACE",
200 Self::VERBOSE => "SDL_LOG_PRIORITY_VERBOSE",
201 Self::DEBUG => "SDL_LOG_PRIORITY_DEBUG",
202 Self::INFO => "SDL_LOG_PRIORITY_INFO",
203 Self::WARN => "SDL_LOG_PRIORITY_WARN",
204 Self::ERROR => "SDL_LOG_PRIORITY_ERROR",
205 Self::CRITICAL => "SDL_LOG_PRIORITY_CRITICAL",
206 Self::COUNT => "SDL_LOG_PRIORITY_COUNT",
207
208 _ => return write!(f, "SDL_LogPriority({})", self.0),
209 })
210 }
211}
212
213impl SDL_LogPriority {
214 pub const INVALID: Self = Self(0);
215 pub const TRACE: Self = Self(1);
216 pub const VERBOSE: Self = Self(2);
217 pub const DEBUG: Self = Self(3);
218 pub const INFO: Self = Self(4);
219 pub const WARN: Self = Self(5);
220 pub const ERROR: Self = Self(6);
221 pub const CRITICAL: Self = Self(7);
222 pub const COUNT: Self = Self(8);
223}
224
225pub const SDL_LOG_PRIORITY_INVALID: SDL_LogPriority = SDL_LogPriority::INVALID;
226pub const SDL_LOG_PRIORITY_TRACE: SDL_LogPriority = SDL_LogPriority::TRACE;
227pub const SDL_LOG_PRIORITY_VERBOSE: SDL_LogPriority = SDL_LogPriority::VERBOSE;
228pub const SDL_LOG_PRIORITY_DEBUG: SDL_LogPriority = SDL_LogPriority::DEBUG;
229pub const SDL_LOG_PRIORITY_INFO: SDL_LogPriority = SDL_LogPriority::INFO;
230pub const SDL_LOG_PRIORITY_WARN: SDL_LogPriority = SDL_LogPriority::WARN;
231pub const SDL_LOG_PRIORITY_ERROR: SDL_LogPriority = SDL_LogPriority::ERROR;
232pub const SDL_LOG_PRIORITY_CRITICAL: SDL_LogPriority = SDL_LogPriority::CRITICAL;
233pub const SDL_LOG_PRIORITY_COUNT: SDL_LogPriority = SDL_LogPriority::COUNT;
234
235extern "C" {
236 /// Set the priority of all log categories.
237 ///
238 /// ### Parameters
239 /// - `priority`: the [`SDL_LogPriority`] to assign.
240 ///
241 /// ### Thread safety
242 /// It is safe to call this function from any thread.
243 ///
244 /// ### Availability
245 /// This function is available since SDL 3.2.0.
246 ///
247 /// ### See also
248 /// - [`SDL_ResetLogPriorities`]
249 /// - [`SDL_SetLogPriority`]
250 pub fn SDL_SetLogPriorities(priority: SDL_LogPriority);
251}
252
253extern "C" {
254 /// Set the priority of a particular log category.
255 ///
256 /// ### Parameters
257 /// - `category`: the category to assign a priority to.
258 /// - `priority`: the [`SDL_LogPriority`] to assign.
259 ///
260 /// ### Thread safety
261 /// It is safe to call this function from any thread.
262 ///
263 /// ### Availability
264 /// This function is available since SDL 3.2.0.
265 ///
266 /// ### See also
267 /// - [`SDL_GetLogPriority`]
268 /// - [`SDL_ResetLogPriorities`]
269 /// - [`SDL_SetLogPriorities`]
270 pub fn SDL_SetLogPriority(category: ::core::ffi::c_int, priority: SDL_LogPriority);
271}
272
273extern "C" {
274 /// Get the priority of a particular log category.
275 ///
276 /// ### Parameters
277 /// - `category`: the category to query.
278 ///
279 /// ### Return value
280 /// Returns the [`SDL_LogPriority`] for the requested category.
281 ///
282 /// ### Thread safety
283 /// It is safe to call this function from any thread.
284 ///
285 /// ### Availability
286 /// This function is available since SDL 3.2.0.
287 ///
288 /// ### See also
289 /// - [`SDL_SetLogPriority`]
290 pub fn SDL_GetLogPriority(category: ::core::ffi::c_int) -> SDL_LogPriority;
291}
292
293extern "C" {
294 /// Reset all priorities to default.
295 ///
296 /// This is called by [`SDL_Quit()`].
297 ///
298 /// ### Thread safety
299 /// It is safe to call this function from any thread.
300 ///
301 /// ### Availability
302 /// This function is available since SDL 3.2.0.
303 ///
304 /// ### See also
305 /// - [`SDL_SetLogPriorities`]
306 /// - [`SDL_SetLogPriority`]
307 pub fn SDL_ResetLogPriorities();
308}
309
310extern "C" {
311 /// Set the text prepended to log messages of a given priority.
312 ///
313 /// By default [`SDL_LOG_PRIORITY_INFO`] and below have no prefix, and
314 /// [`SDL_LOG_PRIORITY_WARN`] and higher have a prefix showing their priority, e.g.
315 /// "WARNING: ".
316 ///
317 /// ### Parameters
318 /// - `priority`: the [`SDL_LogPriority`] to modify.
319 /// - `prefix`: the prefix to use for that log priority, or NULL to use no
320 /// prefix.
321 ///
322 /// ### Return value
323 /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
324 /// information.
325 ///
326 /// ### Thread safety
327 /// It is safe to call this function from any thread.
328 ///
329 /// ### Availability
330 /// This function is available since SDL 3.2.0.
331 ///
332 /// ### See also
333 /// - [`SDL_SetLogPriorities`]
334 /// - [`SDL_SetLogPriority`]
335 pub fn SDL_SetLogPriorityPrefix(
336 priority: SDL_LogPriority,
337 prefix: *const ::core::ffi::c_char,
338 ) -> ::core::primitive::bool;
339}
340
341extern "C" {
342 /// Log a message with [`SDL_LOG_CATEGORY_APPLICATION`] and [`SDL_LOG_PRIORITY_INFO`].
343 ///
344 /// ### Parameters
345 /// - `fmt`: a printf() style message format string.
346 /// - `...`: additional parameters matching % tokens in the `fmt` string, if
347 /// any.
348 ///
349 /// ### Thread safety
350 /// It is safe to call this function from any thread.
351 ///
352 /// ### Availability
353 /// This function is available since SDL 3.2.0.
354 ///
355 /// ### See also
356 /// - [`SDL_LogCritical`]
357 /// - [`SDL_LogDebug`]
358 /// - [`SDL_LogError`]
359 /// - [`SDL_LogInfo`]
360 /// - [`SDL_LogMessage`]
361 /// - [`SDL_LogMessageV`]
362 /// - [`SDL_LogTrace`]
363 /// - [`SDL_LogVerbose`]
364 /// - [`SDL_LogWarn`]
365 pub fn SDL_Log(fmt: *const ::core::ffi::c_char, ...);
366}
367
368extern "C" {
369 /// Log a message with [`SDL_LOG_PRIORITY_TRACE`].
370 ///
371 /// ### Parameters
372 /// - `category`: the category of the message.
373 /// - `fmt`: a printf() style message format string.
374 /// - `...`: additional parameters matching % tokens in the **fmt** string,
375 /// if any.
376 ///
377 /// ### Thread safety
378 /// It is safe to call this function from any thread.
379 ///
380 /// ### Availability
381 /// This function is available since SDL 3.2.0.
382 ///
383 /// ### See also
384 /// - [`SDL_Log`]
385 /// - [`SDL_LogCritical`]
386 /// - [`SDL_LogDebug`]
387 /// - [`SDL_LogError`]
388 /// - [`SDL_LogInfo`]
389 /// - [`SDL_LogMessage`]
390 /// - [`SDL_LogMessageV`]
391 /// - [`SDL_LogTrace`]
392 /// - [`SDL_LogVerbose`]
393 /// - [`SDL_LogWarn`]
394 pub fn SDL_LogTrace(category: ::core::ffi::c_int, fmt: *const ::core::ffi::c_char, ...);
395}
396
397extern "C" {
398 /// Log a message with [`SDL_LOG_PRIORITY_VERBOSE`].
399 ///
400 /// ### Parameters
401 /// - `category`: the category of the message.
402 /// - `fmt`: a printf() style message format string.
403 /// - `...`: additional parameters matching % tokens in the **fmt** string,
404 /// if any.
405 ///
406 /// ### Thread safety
407 /// It is safe to call this function from any thread.
408 ///
409 /// ### Availability
410 /// This function is available since SDL 3.2.0.
411 ///
412 /// ### See also
413 /// - [`SDL_Log`]
414 /// - [`SDL_LogCritical`]
415 /// - [`SDL_LogDebug`]
416 /// - [`SDL_LogError`]
417 /// - [`SDL_LogInfo`]
418 /// - [`SDL_LogMessage`]
419 /// - [`SDL_LogMessageV`]
420 /// - [`SDL_LogWarn`]
421 pub fn SDL_LogVerbose(category: ::core::ffi::c_int, fmt: *const ::core::ffi::c_char, ...);
422}
423
424extern "C" {
425 /// Log a message with [`SDL_LOG_PRIORITY_DEBUG`].
426 ///
427 /// ### Parameters
428 /// - `category`: the category of the message.
429 /// - `fmt`: a printf() style message format string.
430 /// - `...`: additional parameters matching % tokens in the **fmt** string,
431 /// if any.
432 ///
433 /// ### Thread safety
434 /// It is safe to call this function from any thread.
435 ///
436 /// ### Availability
437 /// This function is available since SDL 3.2.0.
438 ///
439 /// ### See also
440 /// - [`SDL_Log`]
441 /// - [`SDL_LogCritical`]
442 /// - [`SDL_LogError`]
443 /// - [`SDL_LogInfo`]
444 /// - [`SDL_LogMessage`]
445 /// - [`SDL_LogMessageV`]
446 /// - [`SDL_LogTrace`]
447 /// - [`SDL_LogVerbose`]
448 /// - [`SDL_LogWarn`]
449 pub fn SDL_LogDebug(category: ::core::ffi::c_int, fmt: *const ::core::ffi::c_char, ...);
450}
451
452extern "C" {
453 /// Log a message with [`SDL_LOG_PRIORITY_INFO`].
454 ///
455 /// ### Parameters
456 /// - `category`: the category of the message.
457 /// - `fmt`: a printf() style message format string.
458 /// - `...`: additional parameters matching % tokens in the **fmt** string,
459 /// if any.
460 ///
461 /// ### Thread safety
462 /// It is safe to call this function from any thread.
463 ///
464 /// ### Availability
465 /// This function is available since SDL 3.2.0.
466 ///
467 /// ### See also
468 /// - [`SDL_Log`]
469 /// - [`SDL_LogCritical`]
470 /// - [`SDL_LogDebug`]
471 /// - [`SDL_LogError`]
472 /// - [`SDL_LogMessage`]
473 /// - [`SDL_LogMessageV`]
474 /// - [`SDL_LogTrace`]
475 /// - [`SDL_LogVerbose`]
476 /// - [`SDL_LogWarn`]
477 pub fn SDL_LogInfo(category: ::core::ffi::c_int, fmt: *const ::core::ffi::c_char, ...);
478}
479
480extern "C" {
481 /// Log a message with [`SDL_LOG_PRIORITY_WARN`].
482 ///
483 /// ### Parameters
484 /// - `category`: the category of the message.
485 /// - `fmt`: a printf() style message format string.
486 /// - `...`: additional parameters matching % tokens in the **fmt** string,
487 /// if any.
488 ///
489 /// ### Thread safety
490 /// It is safe to call this function from any thread.
491 ///
492 /// ### Availability
493 /// This function is available since SDL 3.2.0.
494 ///
495 /// ### See also
496 /// - [`SDL_Log`]
497 /// - [`SDL_LogCritical`]
498 /// - [`SDL_LogDebug`]
499 /// - [`SDL_LogError`]
500 /// - [`SDL_LogInfo`]
501 /// - [`SDL_LogMessage`]
502 /// - [`SDL_LogMessageV`]
503 /// - [`SDL_LogTrace`]
504 /// - [`SDL_LogVerbose`]
505 pub fn SDL_LogWarn(category: ::core::ffi::c_int, fmt: *const ::core::ffi::c_char, ...);
506}
507
508extern "C" {
509 /// Log a message with [`SDL_LOG_PRIORITY_ERROR`].
510 ///
511 /// ### Parameters
512 /// - `category`: the category of the message.
513 /// - `fmt`: a printf() style message format string.
514 /// - `...`: additional parameters matching % tokens in the **fmt** string,
515 /// if any.
516 ///
517 /// ### Thread safety
518 /// It is safe to call this function from any thread.
519 ///
520 /// ### Availability
521 /// This function is available since SDL 3.2.0.
522 ///
523 /// ### See also
524 /// - [`SDL_Log`]
525 /// - [`SDL_LogCritical`]
526 /// - [`SDL_LogDebug`]
527 /// - [`SDL_LogInfo`]
528 /// - [`SDL_LogMessage`]
529 /// - [`SDL_LogMessageV`]
530 /// - [`SDL_LogTrace`]
531 /// - [`SDL_LogVerbose`]
532 /// - [`SDL_LogWarn`]
533 pub fn SDL_LogError(category: ::core::ffi::c_int, fmt: *const ::core::ffi::c_char, ...);
534}
535
536extern "C" {
537 /// Log a message with [`SDL_LOG_PRIORITY_CRITICAL`].
538 ///
539 /// ### Parameters
540 /// - `category`: the category of the message.
541 /// - `fmt`: a printf() style message format string.
542 /// - `...`: additional parameters matching % tokens in the **fmt** string,
543 /// if any.
544 ///
545 /// ### Thread safety
546 /// It is safe to call this function from any thread.
547 ///
548 /// ### Availability
549 /// This function is available since SDL 3.2.0.
550 ///
551 /// ### See also
552 /// - [`SDL_Log`]
553 /// - [`SDL_LogDebug`]
554 /// - [`SDL_LogError`]
555 /// - [`SDL_LogInfo`]
556 /// - [`SDL_LogMessage`]
557 /// - [`SDL_LogMessageV`]
558 /// - [`SDL_LogTrace`]
559 /// - [`SDL_LogVerbose`]
560 /// - [`SDL_LogWarn`]
561 pub fn SDL_LogCritical(category: ::core::ffi::c_int, fmt: *const ::core::ffi::c_char, ...);
562}
563
564extern "C" {
565 /// Log a message with the specified category and priority.
566 ///
567 /// ### Parameters
568 /// - `category`: the category of the message.
569 /// - `priority`: the priority of the message.
570 /// - `fmt`: a printf() style message format string.
571 /// - `...`: additional parameters matching % tokens in the **fmt** string,
572 /// if any.
573 ///
574 /// ### Thread safety
575 /// It is safe to call this function from any thread.
576 ///
577 /// ### Availability
578 /// This function is available since SDL 3.2.0.
579 ///
580 /// ### See also
581 /// - [`SDL_Log`]
582 /// - [`SDL_LogCritical`]
583 /// - [`SDL_LogDebug`]
584 /// - [`SDL_LogError`]
585 /// - [`SDL_LogInfo`]
586 /// - [`SDL_LogMessageV`]
587 /// - [`SDL_LogTrace`]
588 /// - [`SDL_LogVerbose`]
589 /// - [`SDL_LogWarn`]
590 pub fn SDL_LogMessage(
591 category: ::core::ffi::c_int,
592 priority: SDL_LogPriority,
593 fmt: *const ::core::ffi::c_char,
594 ...
595 );
596}
597
598extern "C" {
599 /// Log a message with the specified category and priority.
600 ///
601 /// ### Parameters
602 /// - `category`: the category of the message.
603 /// - `priority`: the priority of the message.
604 /// - `fmt`: a printf() style message format string.
605 /// - `ap`: a variable argument list.
606 ///
607 /// ### Thread safety
608 /// It is safe to call this function from any thread.
609 ///
610 /// ### Availability
611 /// This function is available since SDL 3.2.0.
612 ///
613 /// ### See also
614 /// - [`SDL_Log`]
615 /// - [`SDL_LogCritical`]
616 /// - [`SDL_LogDebug`]
617 /// - [`SDL_LogError`]
618 /// - [`SDL_LogInfo`]
619 /// - [`SDL_LogMessage`]
620 /// - [`SDL_LogTrace`]
621 /// - [`SDL_LogVerbose`]
622 /// - [`SDL_LogWarn`]
623 pub fn SDL_LogMessageV(
624 category: ::core::ffi::c_int,
625 priority: SDL_LogPriority,
626 fmt: *const ::core::ffi::c_char,
627 ap: crate::ffi::VaList,
628 );
629}
630
631/// The prototype for the log output callback function.
632///
633/// This function is called by SDL when there is new text to be logged. A mutex
634/// is held so that this function is never called by more than one thread at
635/// once.
636///
637/// ### Parameters
638/// - `userdata`: what was passed as `userdata` to
639/// [`SDL_SetLogOutputFunction()`].
640/// - `category`: the category of the message.
641/// - `priority`: the priority of the message.
642/// - `message`: the message being output.
643///
644/// ### Availability
645/// This datatype is available since SDL 3.2.0.
646pub type SDL_LogOutputFunction = ::core::option::Option<
647 unsafe extern "C" fn(
648 userdata: *mut ::core::ffi::c_void,
649 category: ::core::ffi::c_int,
650 priority: SDL_LogPriority,
651 message: *const ::core::ffi::c_char,
652 ),
653>;
654
655extern "C" {
656 /// Get the default log output function.
657 ///
658 /// ### Return value
659 /// Returns the default log output callback.
660 ///
661 /// ### Thread safety
662 /// It is safe to call this function from any thread.
663 ///
664 /// ### Availability
665 /// This function is available since SDL 3.2.0.
666 ///
667 /// ### See also
668 /// - [`SDL_SetLogOutputFunction`]
669 /// - [`SDL_GetLogOutputFunction`]
670 pub fn SDL_GetDefaultLogOutputFunction() -> SDL_LogOutputFunction;
671}
672
673extern "C" {
674 /// Get the current log output function.
675 ///
676 /// ### Parameters
677 /// - `callback`: an [`SDL_LogOutputFunction`] filled in with the current log
678 /// callback.
679 /// - `userdata`: a pointer filled in with the pointer that is passed to
680 /// `callback`.
681 ///
682 /// ### Thread safety
683 /// It is safe to call this function from any thread.
684 ///
685 /// ### Availability
686 /// This function is available since SDL 3.2.0.
687 ///
688 /// ### See also
689 /// - [`SDL_GetDefaultLogOutputFunction`]
690 /// - [`SDL_SetLogOutputFunction`]
691 pub fn SDL_GetLogOutputFunction(
692 callback: *mut SDL_LogOutputFunction,
693 userdata: *mut *mut ::core::ffi::c_void,
694 );
695}
696
697extern "C" {
698 /// Replace the default log output function with one of your own.
699 ///
700 /// ### Parameters
701 /// - `callback`: an [`SDL_LogOutputFunction`] to call instead of the default.
702 /// - `userdata`: a pointer that is passed to `callback`.
703 ///
704 /// ### Thread safety
705 /// It is safe to call this function from any thread.
706 ///
707 /// ### Availability
708 /// This function is available since SDL 3.2.0.
709 ///
710 /// ### See also
711 /// - [`SDL_GetDefaultLogOutputFunction`]
712 /// - [`SDL_GetLogOutputFunction`]
713 pub fn SDL_SetLogOutputFunction(
714 callback: SDL_LogOutputFunction,
715 userdata: *mut ::core::ffi::c_void,
716 );
717}
718
719#[cfg(doc)]
720use crate::everything::*;