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 ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_LogCategory {
84 #[inline(always)]
85 fn eq(&self, other: &::core::ffi::c_int) -> bool {
86 &self.0 == other
87 }
88}
89
90impl ::core::cmp::PartialEq<SDL_LogCategory> for ::core::ffi::c_int {
91 #[inline(always)]
92 fn eq(&self, other: &SDL_LogCategory) -> bool {
93 self == &other.0
94 }
95}
96
97impl From<SDL_LogCategory> for ::core::ffi::c_int {
98 #[inline(always)]
99 fn from(value: SDL_LogCategory) -> Self {
100 value.0
101 }
102}
103
104#[cfg(feature = "debug-impls")]
105impl ::core::fmt::Debug for SDL_LogCategory {
106 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
107 #[allow(unreachable_patterns)]
108 f.write_str(match *self {
109 Self::APPLICATION => "SDL_LOG_CATEGORY_APPLICATION",
110 Self::ERROR => "SDL_LOG_CATEGORY_ERROR",
111 Self::ASSERT => "SDL_LOG_CATEGORY_ASSERT",
112 Self::SYSTEM => "SDL_LOG_CATEGORY_SYSTEM",
113 Self::AUDIO => "SDL_LOG_CATEGORY_AUDIO",
114 Self::VIDEO => "SDL_LOG_CATEGORY_VIDEO",
115 Self::RENDER => "SDL_LOG_CATEGORY_RENDER",
116 Self::INPUT => "SDL_LOG_CATEGORY_INPUT",
117 Self::TEST => "SDL_LOG_CATEGORY_TEST",
118 Self::GPU => "SDL_LOG_CATEGORY_GPU",
119 Self::RESERVED2 => "SDL_LOG_CATEGORY_RESERVED2",
120 Self::RESERVED3 => "SDL_LOG_CATEGORY_RESERVED3",
121 Self::RESERVED4 => "SDL_LOG_CATEGORY_RESERVED4",
122 Self::RESERVED5 => "SDL_LOG_CATEGORY_RESERVED5",
123 Self::RESERVED6 => "SDL_LOG_CATEGORY_RESERVED6",
124 Self::RESERVED7 => "SDL_LOG_CATEGORY_RESERVED7",
125 Self::RESERVED8 => "SDL_LOG_CATEGORY_RESERVED8",
126 Self::RESERVED9 => "SDL_LOG_CATEGORY_RESERVED9",
127 Self::RESERVED10 => "SDL_LOG_CATEGORY_RESERVED10",
128 Self::CUSTOM => "SDL_LOG_CATEGORY_CUSTOM",
129
130 _ => return write!(f, "SDL_LogCategory({})", self.0),
131 })
132 }
133}
134
135impl SDL_LogCategory {
136 pub const APPLICATION: Self = Self((0 as ::core::ffi::c_int));
137 pub const ERROR: Self = Self((1 as ::core::ffi::c_int));
138 pub const ASSERT: Self = Self((2 as ::core::ffi::c_int));
139 pub const SYSTEM: Self = Self((3 as ::core::ffi::c_int));
140 pub const AUDIO: Self = Self((4 as ::core::ffi::c_int));
141 pub const VIDEO: Self = Self((5 as ::core::ffi::c_int));
142 pub const RENDER: Self = Self((6 as ::core::ffi::c_int));
143 pub const INPUT: Self = Self((7 as ::core::ffi::c_int));
144 pub const TEST: Self = Self((8 as ::core::ffi::c_int));
145 pub const GPU: Self = Self((9 as ::core::ffi::c_int));
146 pub const RESERVED2: Self = Self((10 as ::core::ffi::c_int));
147 pub const RESERVED3: Self = Self((11 as ::core::ffi::c_int));
148 pub const RESERVED4: Self = Self((12 as ::core::ffi::c_int));
149 pub const RESERVED5: Self = Self((13 as ::core::ffi::c_int));
150 pub const RESERVED6: Self = Self((14 as ::core::ffi::c_int));
151 pub const RESERVED7: Self = Self((15 as ::core::ffi::c_int));
152 pub const RESERVED8: Self = Self((16 as ::core::ffi::c_int));
153 pub const RESERVED9: Self = Self((17 as ::core::ffi::c_int));
154 pub const RESERVED10: Self = Self((18 as ::core::ffi::c_int));
155 pub const CUSTOM: Self = Self((19 as ::core::ffi::c_int));
156}
157
158pub const SDL_LOG_CATEGORY_APPLICATION: SDL_LogCategory = SDL_LogCategory::APPLICATION;
159pub const SDL_LOG_CATEGORY_ERROR: SDL_LogCategory = SDL_LogCategory::ERROR;
160pub const SDL_LOG_CATEGORY_ASSERT: SDL_LogCategory = SDL_LogCategory::ASSERT;
161pub const SDL_LOG_CATEGORY_SYSTEM: SDL_LogCategory = SDL_LogCategory::SYSTEM;
162pub const SDL_LOG_CATEGORY_AUDIO: SDL_LogCategory = SDL_LogCategory::AUDIO;
163pub const SDL_LOG_CATEGORY_VIDEO: SDL_LogCategory = SDL_LogCategory::VIDEO;
164pub const SDL_LOG_CATEGORY_RENDER: SDL_LogCategory = SDL_LogCategory::RENDER;
165pub const SDL_LOG_CATEGORY_INPUT: SDL_LogCategory = SDL_LogCategory::INPUT;
166pub const SDL_LOG_CATEGORY_TEST: SDL_LogCategory = SDL_LogCategory::TEST;
167pub const SDL_LOG_CATEGORY_GPU: SDL_LogCategory = SDL_LogCategory::GPU;
168pub const SDL_LOG_CATEGORY_RESERVED2: SDL_LogCategory = SDL_LogCategory::RESERVED2;
169pub const SDL_LOG_CATEGORY_RESERVED3: SDL_LogCategory = SDL_LogCategory::RESERVED3;
170pub const SDL_LOG_CATEGORY_RESERVED4: SDL_LogCategory = SDL_LogCategory::RESERVED4;
171pub const SDL_LOG_CATEGORY_RESERVED5: SDL_LogCategory = SDL_LogCategory::RESERVED5;
172pub const SDL_LOG_CATEGORY_RESERVED6: SDL_LogCategory = SDL_LogCategory::RESERVED6;
173pub const SDL_LOG_CATEGORY_RESERVED7: SDL_LogCategory = SDL_LogCategory::RESERVED7;
174pub const SDL_LOG_CATEGORY_RESERVED8: SDL_LogCategory = SDL_LogCategory::RESERVED8;
175pub const SDL_LOG_CATEGORY_RESERVED9: SDL_LogCategory = SDL_LogCategory::RESERVED9;
176pub const SDL_LOG_CATEGORY_RESERVED10: SDL_LogCategory = SDL_LogCategory::RESERVED10;
177pub const SDL_LOG_CATEGORY_CUSTOM: SDL_LogCategory = SDL_LogCategory::CUSTOM;
178
179impl SDL_LogCategory {
180 /// Initialize a `SDL_LogCategory` from a raw value.
181 #[inline(always)]
182 pub const fn new(value: ::core::ffi::c_int) -> Self {
183 Self(value)
184 }
185}
186
187impl SDL_LogCategory {
188 /// Get a copy of the inner raw value.
189 #[inline(always)]
190 pub const fn value(&self) -> ::core::ffi::c_int {
191 self.0
192 }
193}
194
195#[cfg(feature = "metadata")]
196impl sdl3_sys::metadata::GroupMetadata for SDL_LogCategory {
197 const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
198 &crate::metadata::log::METADATA_SDL_LogCategory;
199}
200
201/// The predefined log priorities
202///
203/// ## Availability
204/// This enum is available since SDL 3.2.0.
205///
206/// ## Known values (`sdl3-sys`)
207/// | Associated constant | Global constant | Description |
208/// | ------------------- | --------------- | ----------- |
209/// | [`INVALID`](SDL_LogPriority::INVALID) | [`SDL_LOG_PRIORITY_INVALID`] | |
210/// | [`TRACE`](SDL_LogPriority::TRACE) | [`SDL_LOG_PRIORITY_TRACE`] | |
211/// | [`VERBOSE`](SDL_LogPriority::VERBOSE) | [`SDL_LOG_PRIORITY_VERBOSE`] | |
212/// | [`DEBUG`](SDL_LogPriority::DEBUG) | [`SDL_LOG_PRIORITY_DEBUG`] | |
213/// | [`INFO`](SDL_LogPriority::INFO) | [`SDL_LOG_PRIORITY_INFO`] | |
214/// | [`WARN`](SDL_LogPriority::WARN) | [`SDL_LOG_PRIORITY_WARN`] | |
215/// | [`ERROR`](SDL_LogPriority::ERROR) | [`SDL_LOG_PRIORITY_ERROR`] | |
216/// | [`CRITICAL`](SDL_LogPriority::CRITICAL) | [`SDL_LOG_PRIORITY_CRITICAL`] | |
217/// | [`COUNT`](SDL_LogPriority::COUNT) | [`SDL_LOG_PRIORITY_COUNT`] | |
218#[repr(transparent)]
219#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
220pub struct SDL_LogPriority(pub ::core::ffi::c_int);
221
222impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_LogPriority {
223 #[inline(always)]
224 fn eq(&self, other: &::core::ffi::c_int) -> bool {
225 &self.0 == other
226 }
227}
228
229impl ::core::cmp::PartialEq<SDL_LogPriority> for ::core::ffi::c_int {
230 #[inline(always)]
231 fn eq(&self, other: &SDL_LogPriority) -> bool {
232 self == &other.0
233 }
234}
235
236impl From<SDL_LogPriority> for ::core::ffi::c_int {
237 #[inline(always)]
238 fn from(value: SDL_LogPriority) -> Self {
239 value.0
240 }
241}
242
243#[cfg(feature = "debug-impls")]
244impl ::core::fmt::Debug for SDL_LogPriority {
245 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
246 #[allow(unreachable_patterns)]
247 f.write_str(match *self {
248 Self::INVALID => "SDL_LOG_PRIORITY_INVALID",
249 Self::TRACE => "SDL_LOG_PRIORITY_TRACE",
250 Self::VERBOSE => "SDL_LOG_PRIORITY_VERBOSE",
251 Self::DEBUG => "SDL_LOG_PRIORITY_DEBUG",
252 Self::INFO => "SDL_LOG_PRIORITY_INFO",
253 Self::WARN => "SDL_LOG_PRIORITY_WARN",
254 Self::ERROR => "SDL_LOG_PRIORITY_ERROR",
255 Self::CRITICAL => "SDL_LOG_PRIORITY_CRITICAL",
256 Self::COUNT => "SDL_LOG_PRIORITY_COUNT",
257
258 _ => return write!(f, "SDL_LogPriority({})", self.0),
259 })
260 }
261}
262
263impl SDL_LogPriority {
264 pub const INVALID: Self = Self((0 as ::core::ffi::c_int));
265 pub const TRACE: Self = Self((1 as ::core::ffi::c_int));
266 pub const VERBOSE: Self = Self((2 as ::core::ffi::c_int));
267 pub const DEBUG: Self = Self((3 as ::core::ffi::c_int));
268 pub const INFO: Self = Self((4 as ::core::ffi::c_int));
269 pub const WARN: Self = Self((5 as ::core::ffi::c_int));
270 pub const ERROR: Self = Self((6 as ::core::ffi::c_int));
271 pub const CRITICAL: Self = Self((7 as ::core::ffi::c_int));
272 pub const COUNT: Self = Self((8 as ::core::ffi::c_int));
273}
274
275pub const SDL_LOG_PRIORITY_INVALID: SDL_LogPriority = SDL_LogPriority::INVALID;
276pub const SDL_LOG_PRIORITY_TRACE: SDL_LogPriority = SDL_LogPriority::TRACE;
277pub const SDL_LOG_PRIORITY_VERBOSE: SDL_LogPriority = SDL_LogPriority::VERBOSE;
278pub const SDL_LOG_PRIORITY_DEBUG: SDL_LogPriority = SDL_LogPriority::DEBUG;
279pub const SDL_LOG_PRIORITY_INFO: SDL_LogPriority = SDL_LogPriority::INFO;
280pub const SDL_LOG_PRIORITY_WARN: SDL_LogPriority = SDL_LogPriority::WARN;
281pub const SDL_LOG_PRIORITY_ERROR: SDL_LogPriority = SDL_LogPriority::ERROR;
282pub const SDL_LOG_PRIORITY_CRITICAL: SDL_LogPriority = SDL_LogPriority::CRITICAL;
283pub const SDL_LOG_PRIORITY_COUNT: SDL_LogPriority = SDL_LogPriority::COUNT;
284
285impl SDL_LogPriority {
286 /// Initialize a `SDL_LogPriority` from a raw value.
287 #[inline(always)]
288 pub const fn new(value: ::core::ffi::c_int) -> Self {
289 Self(value)
290 }
291}
292
293impl SDL_LogPriority {
294 /// Get a copy of the inner raw value.
295 #[inline(always)]
296 pub const fn value(&self) -> ::core::ffi::c_int {
297 self.0
298 }
299}
300
301#[cfg(feature = "metadata")]
302impl sdl3_sys::metadata::GroupMetadata for SDL_LogPriority {
303 const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
304 &crate::metadata::log::METADATA_SDL_LogPriority;
305}
306
307unsafe extern "C" {
308 /// Set the priority of all log categories.
309 ///
310 /// ## Parameters
311 /// - `priority`: the [`SDL_LogPriority`] to assign.
312 ///
313 /// ## Thread safety
314 /// It is safe to call this function from any thread.
315 ///
316 /// ## Availability
317 /// This function is available since SDL 3.2.0.
318 ///
319 /// ## See also
320 /// - [`SDL_ResetLogPriorities`]
321 /// - [`SDL_SetLogPriority`]
322 pub fn SDL_SetLogPriorities(priority: SDL_LogPriority);
323}
324
325unsafe extern "C" {
326 /// Set the priority of a particular log category.
327 ///
328 /// ## Parameters
329 /// - `category`: the category to assign a priority to.
330 /// - `priority`: the [`SDL_LogPriority`] to assign.
331 ///
332 /// ## Thread safety
333 /// It is safe to call this function from any thread.
334 ///
335 /// ## Availability
336 /// This function is available since SDL 3.2.0.
337 ///
338 /// ## See also
339 /// - [`SDL_GetLogPriority`]
340 /// - [`SDL_ResetLogPriorities`]
341 /// - [`SDL_SetLogPriorities`]
342 pub fn SDL_SetLogPriority(category: ::core::ffi::c_int, priority: SDL_LogPriority);
343}
344
345unsafe extern "C" {
346 /// Get the priority of a particular log category.
347 ///
348 /// ## Parameters
349 /// - `category`: the category to query.
350 ///
351 /// ## Return value
352 /// Returns the [`SDL_LogPriority`] for the requested category.
353 ///
354 /// ## Thread safety
355 /// It is safe to call this function from any thread.
356 ///
357 /// ## Availability
358 /// This function is available since SDL 3.2.0.
359 ///
360 /// ## See also
361 /// - [`SDL_SetLogPriority`]
362 pub fn SDL_GetLogPriority(category: ::core::ffi::c_int) -> SDL_LogPriority;
363}
364
365unsafe extern "C" {
366 /// Reset all priorities to default.
367 ///
368 /// This is called by [`SDL_Quit()`].
369 ///
370 /// ## Thread safety
371 /// It is safe to call this function from any thread.
372 ///
373 /// ## Availability
374 /// This function is available since SDL 3.2.0.
375 ///
376 /// ## See also
377 /// - [`SDL_SetLogPriorities`]
378 /// - [`SDL_SetLogPriority`]
379 pub fn SDL_ResetLogPriorities();
380}
381
382unsafe extern "C" {
383 /// Set the text prepended to log messages of a given priority.
384 ///
385 /// By default [`SDL_LOG_PRIORITY_INFO`] and below have no prefix, and
386 /// [`SDL_LOG_PRIORITY_WARN`] and higher have a prefix showing their priority, e.g.
387 /// "WARNING: ".
388 ///
389 /// This function makes a copy of its string argument, **prefix**, so it is not
390 /// necessary to keep the value of **prefix** alive after the call returns.
391 ///
392 /// ## Parameters
393 /// - `priority`: the [`SDL_LogPriority`] to modify.
394 /// - `prefix`: the prefix to use for that log priority, or NULL to use no
395 /// prefix.
396 ///
397 /// ## Return value
398 /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
399 /// information.
400 ///
401 /// ## Thread safety
402 /// It is safe to call this function from any thread.
403 ///
404 /// ## Availability
405 /// This function is available since SDL 3.2.0.
406 ///
407 /// ## See also
408 /// - [`SDL_SetLogPriorities`]
409 /// - [`SDL_SetLogPriority`]
410 pub fn SDL_SetLogPriorityPrefix(
411 priority: SDL_LogPriority,
412 prefix: *const ::core::ffi::c_char,
413 ) -> ::core::primitive::bool;
414}
415
416unsafe extern "C" {
417 /// Log a message with [`SDL_LOG_CATEGORY_APPLICATION`] and [`SDL_LOG_PRIORITY_INFO`].
418 ///
419 /// ## Parameters
420 /// - `fmt`: a printf() style message format string.
421 /// - `...`: additional parameters matching % tokens in the `fmt` string, if
422 /// any.
423 ///
424 /// ## Thread safety
425 /// It is safe to call this function from any thread.
426 ///
427 /// ## Availability
428 /// This function is available since SDL 3.2.0.
429 ///
430 /// ## See also
431 /// - [`SDL_LogCritical`]
432 /// - [`SDL_LogDebug`]
433 /// - [`SDL_LogError`]
434 /// - [`SDL_LogInfo`]
435 /// - [`SDL_LogMessage`]
436 /// - [`SDL_LogMessageV`]
437 /// - [`SDL_LogTrace`]
438 /// - [`SDL_LogVerbose`]
439 /// - [`SDL_LogWarn`]
440 pub fn SDL_Log(fmt: *const ::core::ffi::c_char, ...);
441}
442
443unsafe extern "C" {
444 /// Log a message with [`SDL_LOG_PRIORITY_TRACE`].
445 ///
446 /// ## Parameters
447 /// - `category`: the category of the message.
448 /// - `fmt`: a printf() style message format string.
449 /// - `...`: additional parameters matching % tokens in the **fmt** string,
450 /// if any.
451 ///
452 /// ## Thread safety
453 /// It is safe to call this function from any thread.
454 ///
455 /// ## Availability
456 /// This function is available since SDL 3.2.0.
457 ///
458 /// ## See also
459 /// - [`SDL_Log`]
460 /// - [`SDL_LogCritical`]
461 /// - [`SDL_LogDebug`]
462 /// - [`SDL_LogError`]
463 /// - [`SDL_LogInfo`]
464 /// - [`SDL_LogMessage`]
465 /// - [`SDL_LogMessageV`]
466 /// - [`SDL_LogVerbose`]
467 /// - [`SDL_LogWarn`]
468 pub fn SDL_LogTrace(category: ::core::ffi::c_int, fmt: *const ::core::ffi::c_char, ...);
469}
470
471unsafe extern "C" {
472 /// Log a message with [`SDL_LOG_PRIORITY_VERBOSE`].
473 ///
474 /// ## Parameters
475 /// - `category`: the category of the message.
476 /// - `fmt`: a printf() style message format string.
477 /// - `...`: additional parameters matching % tokens in the **fmt** string,
478 /// if any.
479 ///
480 /// ## Thread safety
481 /// It is safe to call this function from any thread.
482 ///
483 /// ## Availability
484 /// This function is available since SDL 3.2.0.
485 ///
486 /// ## See also
487 /// - [`SDL_Log`]
488 /// - [`SDL_LogCritical`]
489 /// - [`SDL_LogDebug`]
490 /// - [`SDL_LogError`]
491 /// - [`SDL_LogInfo`]
492 /// - [`SDL_LogMessage`]
493 /// - [`SDL_LogMessageV`]
494 /// - [`SDL_LogWarn`]
495 pub fn SDL_LogVerbose(category: ::core::ffi::c_int, fmt: *const ::core::ffi::c_char, ...);
496}
497
498unsafe extern "C" {
499 /// Log a message with [`SDL_LOG_PRIORITY_DEBUG`].
500 ///
501 /// ## Parameters
502 /// - `category`: the category of the message.
503 /// - `fmt`: a printf() style message format string.
504 /// - `...`: additional parameters matching % tokens in the **fmt** string,
505 /// if any.
506 ///
507 /// ## Thread safety
508 /// It is safe to call this function from any thread.
509 ///
510 /// ## Availability
511 /// This function is available since SDL 3.2.0.
512 ///
513 /// ## See also
514 /// - [`SDL_Log`]
515 /// - [`SDL_LogCritical`]
516 /// - [`SDL_LogError`]
517 /// - [`SDL_LogInfo`]
518 /// - [`SDL_LogMessage`]
519 /// - [`SDL_LogMessageV`]
520 /// - [`SDL_LogTrace`]
521 /// - [`SDL_LogVerbose`]
522 /// - [`SDL_LogWarn`]
523 pub fn SDL_LogDebug(category: ::core::ffi::c_int, fmt: *const ::core::ffi::c_char, ...);
524}
525
526unsafe extern "C" {
527 /// Log a message with [`SDL_LOG_PRIORITY_INFO`].
528 ///
529 /// ## Parameters
530 /// - `category`: the category of the message.
531 /// - `fmt`: a printf() style message format string.
532 /// - `...`: additional parameters matching % tokens in the **fmt** string,
533 /// if any.
534 ///
535 /// ## Thread safety
536 /// It is safe to call this function from any thread.
537 ///
538 /// ## Availability
539 /// This function is available since SDL 3.2.0.
540 ///
541 /// ## See also
542 /// - [`SDL_Log`]
543 /// - [`SDL_LogCritical`]
544 /// - [`SDL_LogDebug`]
545 /// - [`SDL_LogError`]
546 /// - [`SDL_LogMessage`]
547 /// - [`SDL_LogMessageV`]
548 /// - [`SDL_LogTrace`]
549 /// - [`SDL_LogVerbose`]
550 /// - [`SDL_LogWarn`]
551 pub fn SDL_LogInfo(category: ::core::ffi::c_int, fmt: *const ::core::ffi::c_char, ...);
552}
553
554unsafe extern "C" {
555 /// Log a message with [`SDL_LOG_PRIORITY_WARN`].
556 ///
557 /// ## Parameters
558 /// - `category`: the category of the message.
559 /// - `fmt`: a printf() style message format string.
560 /// - `...`: additional parameters matching % tokens in the **fmt** string,
561 /// if any.
562 ///
563 /// ## Thread safety
564 /// It is safe to call this function from any thread.
565 ///
566 /// ## Availability
567 /// This function is available since SDL 3.2.0.
568 ///
569 /// ## See also
570 /// - [`SDL_Log`]
571 /// - [`SDL_LogCritical`]
572 /// - [`SDL_LogDebug`]
573 /// - [`SDL_LogError`]
574 /// - [`SDL_LogInfo`]
575 /// - [`SDL_LogMessage`]
576 /// - [`SDL_LogMessageV`]
577 /// - [`SDL_LogTrace`]
578 /// - [`SDL_LogVerbose`]
579 pub fn SDL_LogWarn(category: ::core::ffi::c_int, fmt: *const ::core::ffi::c_char, ...);
580}
581
582unsafe extern "C" {
583 /// Log a message with [`SDL_LOG_PRIORITY_ERROR`].
584 ///
585 /// ## Parameters
586 /// - `category`: the category of the message.
587 /// - `fmt`: a printf() style message format string.
588 /// - `...`: additional parameters matching % tokens in the **fmt** string,
589 /// if any.
590 ///
591 /// ## Thread safety
592 /// It is safe to call this function from any thread.
593 ///
594 /// ## Availability
595 /// This function is available since SDL 3.2.0.
596 ///
597 /// ## See also
598 /// - [`SDL_Log`]
599 /// - [`SDL_LogCritical`]
600 /// - [`SDL_LogDebug`]
601 /// - [`SDL_LogInfo`]
602 /// - [`SDL_LogMessage`]
603 /// - [`SDL_LogMessageV`]
604 /// - [`SDL_LogTrace`]
605 /// - [`SDL_LogVerbose`]
606 /// - [`SDL_LogWarn`]
607 pub fn SDL_LogError(category: ::core::ffi::c_int, fmt: *const ::core::ffi::c_char, ...);
608}
609
610unsafe extern "C" {
611 /// Log a message with [`SDL_LOG_PRIORITY_CRITICAL`].
612 ///
613 /// ## Parameters
614 /// - `category`: the category of the message.
615 /// - `fmt`: a printf() style message format string.
616 /// - `...`: additional parameters matching % tokens in the **fmt** string,
617 /// if any.
618 ///
619 /// ## Thread safety
620 /// It is safe to call this function from any thread.
621 ///
622 /// ## Availability
623 /// This function is available since SDL 3.2.0.
624 ///
625 /// ## See also
626 /// - [`SDL_Log`]
627 /// - [`SDL_LogDebug`]
628 /// - [`SDL_LogError`]
629 /// - [`SDL_LogInfo`]
630 /// - [`SDL_LogMessage`]
631 /// - [`SDL_LogMessageV`]
632 /// - [`SDL_LogTrace`]
633 /// - [`SDL_LogVerbose`]
634 /// - [`SDL_LogWarn`]
635 pub fn SDL_LogCritical(category: ::core::ffi::c_int, fmt: *const ::core::ffi::c_char, ...);
636}
637
638unsafe extern "C" {
639 /// Log a message with the specified category and priority.
640 ///
641 /// ## Parameters
642 /// - `category`: the category of the message.
643 /// - `priority`: the priority of the message.
644 /// - `fmt`: a printf() style message format string.
645 /// - `...`: additional parameters matching % tokens in the **fmt** string,
646 /// if any.
647 ///
648 /// ## Thread safety
649 /// It is safe to call this function from any thread.
650 ///
651 /// ## Availability
652 /// This function is available since SDL 3.2.0.
653 ///
654 /// ## See also
655 /// - [`SDL_Log`]
656 /// - [`SDL_LogCritical`]
657 /// - [`SDL_LogDebug`]
658 /// - [`SDL_LogError`]
659 /// - [`SDL_LogInfo`]
660 /// - [`SDL_LogMessageV`]
661 /// - [`SDL_LogTrace`]
662 /// - [`SDL_LogVerbose`]
663 /// - [`SDL_LogWarn`]
664 pub fn SDL_LogMessage(
665 category: ::core::ffi::c_int,
666 priority: SDL_LogPriority,
667 fmt: *const ::core::ffi::c_char,
668 ...
669 );
670}
671
672unsafe extern "C" {
673 /// Log a message with the specified category and priority.
674 ///
675 /// ## Parameters
676 /// - `category`: the category of the message.
677 /// - `priority`: the priority of the message.
678 /// - `fmt`: a printf() style message format string.
679 /// - `ap`: a variable argument list.
680 ///
681 /// ## Thread safety
682 /// It is safe to call this function from any thread.
683 ///
684 /// ## Availability
685 /// This function is available since SDL 3.2.0.
686 ///
687 /// ## See also
688 /// - [`SDL_Log`]
689 /// - [`SDL_LogCritical`]
690 /// - [`SDL_LogDebug`]
691 /// - [`SDL_LogError`]
692 /// - [`SDL_LogInfo`]
693 /// - [`SDL_LogMessage`]
694 /// - [`SDL_LogTrace`]
695 /// - [`SDL_LogVerbose`]
696 /// - [`SDL_LogWarn`]
697 pub fn SDL_LogMessageV(
698 category: ::core::ffi::c_int,
699 priority: SDL_LogPriority,
700 fmt: *const ::core::ffi::c_char,
701 ap: crate::ffi::VaList,
702 );
703}
704
705/// The prototype for the log output callback function.
706///
707/// This function is called by SDL when there is new text to be logged. A mutex
708/// is held so that this function is never called by more than one thread at
709/// once.
710///
711/// ## Parameters
712/// - `userdata`: what was passed as `userdata` to
713/// [`SDL_SetLogOutputFunction()`].
714/// - `category`: the category of the message.
715/// - `priority`: the priority of the message.
716/// - `message`: the message being output.
717///
718/// ## Availability
719/// This datatype is available since SDL 3.2.0.
720pub type SDL_LogOutputFunction = ::core::option::Option<
721 unsafe extern "C" fn(
722 userdata: *mut ::core::ffi::c_void,
723 category: ::core::ffi::c_int,
724 priority: SDL_LogPriority,
725 message: *const ::core::ffi::c_char,
726 ),
727>;
728
729unsafe extern "C" {
730 /// Get the default log output function.
731 ///
732 /// ## Return value
733 /// Returns the default log output callback. It should be called with NULL for
734 /// the userdata argument.
735 ///
736 /// ## Thread safety
737 /// It is safe to call this function from any thread.
738 ///
739 /// ## Availability
740 /// This function is available since SDL 3.2.0.
741 ///
742 /// ## See also
743 /// - [`SDL_SetLogOutputFunction`]
744 /// - [`SDL_GetLogOutputFunction`]
745 pub fn SDL_GetDefaultLogOutputFunction() -> SDL_LogOutputFunction;
746}
747
748unsafe extern "C" {
749 /// Get the current log output function.
750 ///
751 /// ## Parameters
752 /// - `callback`: an [`SDL_LogOutputFunction`] filled in with the current log
753 /// callback.
754 /// - `userdata`: a pointer filled in with the pointer that is passed to
755 /// `callback`.
756 ///
757 /// ## Thread safety
758 /// It is safe to call this function from any thread.
759 ///
760 /// ## Availability
761 /// This function is available since SDL 3.2.0.
762 ///
763 /// ## See also
764 /// - [`SDL_GetDefaultLogOutputFunction`]
765 /// - [`SDL_SetLogOutputFunction`]
766 pub fn SDL_GetLogOutputFunction(
767 callback: *mut SDL_LogOutputFunction,
768 userdata: *mut *mut ::core::ffi::c_void,
769 );
770}
771
772unsafe extern "C" {
773 /// Replace the default log output function with one of your own.
774 ///
775 /// ## Parameters
776 /// - `callback`: an [`SDL_LogOutputFunction`] to call instead of the default.
777 /// - `userdata`: a pointer that is passed to `callback`.
778 ///
779 /// ## Thread safety
780 /// It is safe to call this function from any thread.
781 ///
782 /// ## Availability
783 /// This function is available since SDL 3.2.0.
784 ///
785 /// ## See also
786 /// - [`SDL_GetDefaultLogOutputFunction`]
787 /// - [`SDL_GetLogOutputFunction`]
788 pub fn SDL_SetLogOutputFunction(
789 callback: SDL_LogOutputFunction,
790 userdata: *mut ::core::ffi::c_void,
791 );
792}
793
794#[cfg(doc)]
795use crate::everything::*;