SDL3pp
A slim C++ wrapper for SDL3
Loading...
Searching...
No Matches
Log Handling

Simple log messages with priorities and categories. More...

Classes

class  SDL::LogCategory
 The predefined log categories. More...

Typedefs

using SDL::LogCategoryRaw = SDL_LogCategory
 Alias to raw representation for LogCategory.

Functions

constexpr SDL::LogCategory::LogCategory (LogCategoryRaw category=SDL_LOG_CATEGORY_APPLICATION) noexcept
 Wraps LogCategory.
constexpr SDL::LogCategory::LogCategory (int category)
 Wraps LogCategory.
constexpr SDL::LogCategory::operator LogCategoryRaw () const noexcept
 Unwraps to the underlying LogCategory.
void SDL::LogCategory::LogUnformatted (LogPriority priority, StringParam message) const
 Log an unformatted message with the specified priority.

LogPriorities

The priorities assignable for a LogCategory.

using SDL::LogPriority = SDL_LogPriority
 The predefined log priorities.
constexpr LogPriority SDL::LOG_PRIORITY_INVALID
 INVALID.
constexpr LogPriority SDL::LOG_PRIORITY_TRACE = SDL_LOG_PRIORITY_TRACE
 TRACE.
constexpr LogPriority SDL::LOG_PRIORITY_VERBOSE
 VERBOSE.
constexpr LogPriority SDL::LOG_PRIORITY_DEBUG = SDL_LOG_PRIORITY_DEBUG
 DEBUG.
constexpr LogPriority SDL::LOG_PRIORITY_INFO = SDL_LOG_PRIORITY_INFO
 INFO.
constexpr LogPriority SDL::LOG_PRIORITY_WARN = SDL_LOG_PRIORITY_WARN
 WARN.
constexpr LogPriority SDL::LOG_PRIORITY_ERROR = SDL_LOG_PRIORITY_ERROR
 ERROR.
constexpr LogPriority SDL::LOG_PRIORITY_CRITICAL
 CRITICAL.
constexpr LogPriority SDL::LOG_PRIORITY_COUNT = SDL_LOG_PRIORITY_COUNT
 COUNT.

LogCategories

The logging categories.

see LogCategory for more info

using SDL::LogOutputFunction
 The prototype for the log output callback function.
using SDL::LogOutputCB
 The prototype for the log output callback function.
constexpr LogCategory SDL::LOG_CATEGORY_APPLICATION
 APPLICATION.
constexpr LogCategory SDL::LOG_CATEGORY_ERROR = SDL_LOG_CATEGORY_ERROR
 ERROR.
constexpr LogCategory SDL::LOG_CATEGORY_ASSERT = SDL_LOG_CATEGORY_ASSERT
 ASSERT.
constexpr LogCategory SDL::LOG_CATEGORY_SYSTEM = SDL_LOG_CATEGORY_SYSTEM
 SYSTEM.
constexpr LogCategory SDL::LOG_CATEGORY_AUDIO = SDL_LOG_CATEGORY_AUDIO
 AUDIO.
constexpr LogCategory SDL::LOG_CATEGORY_VIDEO = SDL_LOG_CATEGORY_VIDEO
 VIDEO.
constexpr LogCategory SDL::LOG_CATEGORY_RENDER = SDL_LOG_CATEGORY_RENDER
 RENDER.
constexpr LogCategory SDL::LOG_CATEGORY_INPUT = SDL_LOG_CATEGORY_INPUT
 INPUT.
constexpr LogCategory SDL::LOG_CATEGORY_TEST = SDL_LOG_CATEGORY_TEST
 TEST.
constexpr LogCategory SDL::LOG_CATEGORY_GPU = SDL_LOG_CATEGORY_GPU
 GPU.
constexpr LogCategory SDL::LOG_CATEGORY_RESERVED2
 RESERVED2.
constexpr LogCategory SDL::LOG_CATEGORY_RESERVED3
 RESERVED3.
constexpr LogCategory SDL::LOG_CATEGORY_RESERVED4
 RESERVED4.
constexpr LogCategory SDL::LOG_CATEGORY_RESERVED5
 RESERVED5.
constexpr LogCategory SDL::LOG_CATEGORY_RESERVED6
 RESERVED6.
constexpr LogCategory SDL::LOG_CATEGORY_RESERVED7
 RESERVED7.
constexpr LogCategory SDL::LOG_CATEGORY_RESERVED8
 RESERVED8.
constexpr LogCategory SDL::LOG_CATEGORY_RESERVED9
 RESERVED9.
constexpr LogCategory SDL::LOG_CATEGORY_RESERVED10
 RESERVED10.
constexpr LogCategory SDL::LOG_CATEGORY_CUSTOM = SDL_LOG_CATEGORY_CUSTOM
 CUSTOM.
void SDL::LogCategory::SetLogPriority (LogPriority priority) const
 Set the priority of a particular log category.
LogPriority SDL::LogCategory::GetLogPriority () const
 Get the priority of a particular log category.
template<class... ARGS>
void SDL::LogCategory::LogMessage (LogPriority priority, std::string_view fmt, ARGS... args) const
 Log a message with the specified priority.
template<class... ARGS>
void SDL::LogCategory::LogTrace (std::string_view fmt, ARGS &&... args) const
 Log a message with LOG_PRIORITY_TRACE.
template<class... ARGS>
void SDL::LogCategory::LogVerbose (std::string_view fmt, ARGS &&... args) const
 Log a message with LOG_PRIORITY_VERBOSE.
template<class... ARGS>
void SDL::LogCategory::LogDebug (std::string_view fmt, ARGS &&... args) const
 Log a message with LOG_PRIORITY_DEBUG.
template<class... ARGS>
void SDL::LogCategory::LogInfo (std::string_view fmt, ARGS &&... args) const
 Log a message with LOG_PRIORITY_INFO.
template<class... ARGS>
void SDL::LogCategory::LogWarn (std::string_view fmt, ARGS &&... args) const
 Log a message with LOG_PRIORITY_WARN.
template<class... ARGS>
void SDL::LogCategory::LogError (std::string_view fmt, ARGS &&... args) const
 Log a message with LOG_PRIORITY_ERROR.
template<class... ARGS>
void SDL::LogCategory::LogCritical (std::string_view fmt, ARGS &&... args) const
 Log a message with LOG_PRIORITY_CRITICAL.
void SDL::SetLogPriorities (LogPriority priority)
 Set the priority of all log categories.
void SDL::SetLogPriority (int category, LogPriority priority)
 Set the priority of a particular log category.
LogPriority SDL::GetLogPriority (int category)
 Get the priority of a particular log category.
void SDL::ResetLogPriorities ()
 Reset all priorities to default.
void SDL::SetLogPriorityPrefix (LogPriority priority, StringParam prefix)
 Set the text prepended to log messages of a given priority.
void SDL::LogUnformatted (LogCategory category, LogPriority priority, StringParam message)
 Log an unformatted message with LOG_CATEGORY_APPLICATION and LOG_PRIORITY_INFO.
void SDL::LogUnformatted (StringParam message)
 Log an unformatted message with LOG_CATEGORY_APPLICATION and LOG_PRIORITY_INFO.
template<class... ARGS>
void SDL::Log (std::string_view fmt, ARGS &&... args)
 Log a message with LOG_CATEGORY_APPLICATION and LOG_PRIORITY_INFO.
template<class... ARGS>
void SDL::LogMessage (LogCategory category, LogPriority priority, std::string_view fmt, ARGS... args)
 Log a message with the specified category and priority.
template<class... ARGS>
void SDL::LogTrace (LogCategory category, std::string_view fmt, ARGS &&... args)
 Log a message with LOG_PRIORITY_TRACE.
template<class... ARGS>
void SDL::LogVerbose (LogCategory category, std::string_view fmt, ARGS &&... args)
 Log a message with LOG_PRIORITY_VERBOSE.
template<class... ARGS>
void SDL::LogDebug (LogCategory category, std::string_view fmt, ARGS &&... args)
 Log a message with LOG_PRIORITY_DEBUG.
template<class... ARGS>
void SDL::LogInfo (LogCategory category, std::string_view fmt, ARGS &&... args)
 Log a message with LOG_PRIORITY_INFO.
template<class... ARGS>
void SDL::LogWarn (LogCategory category, std::string_view fmt, ARGS &&... args)
 Log a message with LOG_PRIORITY_WARN.
template<class... ARGS>
void SDL::LogError (LogCategory category, std::string_view fmt, ARGS &&... args)
 Log a message with LOG_PRIORITY_ERROR.
template<class... ARGS>
void SDL::LogCritical (LogCategory category, std::string_view fmt, ARGS &&... args)
 Log a message with LOG_PRIORITY_CRITICAL.
LogOutputFunction SDL::GetDefaultLogOutputFunction ()
 Get the default log output function.
void SDL::GetLogOutputFunction (LogOutputFunction *callback, void **userdata)
 Get the current log output function.
void SDL::SetLogOutputFunction (LogOutputFunction callback, void *userdata)
 Replace the default log output function with one of your own.
void SDL::SetLogOutputFunction (LogOutputCB callback)
 Replace the default log output function with one of your own.
void SDL::ResetLogOutputFunction ()
 Replace the current log output function with the default one.

Detailed Description

Simple log messages with priorities and categories.

A message's LogPriority signifies how important the message is. A message's LogCategory signifies from what domain it belongs to. Every category has a minimum priority specified: when a message belongs to that category, it will only be sent out if it has that minimum priority or higher.

SDL's own logs are sent below the default priority threshold, so they are quiet by default.

You can change the log verbosity programmatically using LogCategory.SetLogPriority() or with SetHint(SDL_HINT_LOGGING, ...), or with the "SDL_LOGGING" environment variable. This variable is a comma separated set of category=level tokens that define the default logging levels for SDL applications.

The category can be a numeric category, one of "app", "error", "assert", "system", "audio", "video", "render", "input", "test", or * for any unspecified category.

The level can be a numeric level, one of "trace", "verbose", "debug", "info", "warn", "error", "critical", or "quiet" to disable that category.

You can omit the category if you want to set the logging level for all categories.

If this hint isn't set, the default log levels are equivalent to:

app=info,assert=warn,test=verbose,*=error

Here's where the messages go on different platforms:

  • Windows: debug output stream
  • Android: log output
  • Others: standard error output (stderr)

You don't need to have a newline (@n) on the end of messages, the functions will do that for you. For consistent behavior cross-platform, you shouldn't have any newlines in messages, such as to log multiple lines in one call; unusual platform-specific behavior can be observed in such usage. Do one log call per line instead, with no newlines in messages.

Each log call is atomic, so you won't see log messages cut off one another when logging from multiple threads.

Typedef Documentation

◆ LogOutputCB

Initial value:
void(int category, LogPriority priority, const char* message)>
SDL_LogPriority LogPriority
The predefined log priorities.
Definition SDL3pp_log.h:81
Definition SDL3pp_callbackWrapper.h:169

The prototype for the log output callback function.

This function is called by SDL when there is new text to be logged. A mutex is held so that this function is never called by more than one thread at once.

Parameters
categorythe category of the message.
prioritythe priority of the message.
messagethe message being output.
Since
This datatype is available since SDL 3.2.0.
Category:
Listener callback
See also
LogOutputFunction

◆ LogOutputFunction

Initial value:
void(SDLCALL*)(void* userdata,
int category,
LogPriority priority,
const char* message)

The prototype for the log output callback function.

This function is called by SDL when there is new text to be logged. A mutex is held so that this function is never called by more than one thread at once.

Parameters
userdatawhat was passed as userdata to SetLogOutputFunction().
categorythe category of the message.
prioritythe priority of the message.
messagethe message being output.
Since
This datatype is available since SDL 3.2.0.

◆ LogPriority

using SDL::LogPriority = SDL_LogPriority

The predefined log priorities.

Since
This enum is available since SDL 3.2.0.

Function Documentation

◆ GetDefaultLogOutputFunction()

LogOutputFunction SDL::GetDefaultLogOutputFunction ( )
inline

Get the default log output function.

Returns
the default log output callback. It should be called with nullptr for the userdata argument.
Thread safety:
It is safe to call this function from any thread.
Since
This function is available since SDL 3.2.0.
See also
SetLogOutputFunction
GetLogOutputFunction

◆ GetLogOutputFunction()

void SDL::GetLogOutputFunction ( LogOutputFunction * callback,
void ** userdata )
inline

Get the current log output function.

Parameters
callbackan LogOutputFunction filled in with the current log callback.
userdataa pointer filled in with the pointer that is passed to callback.
Thread safety:
It is safe to call this function from any thread.
Since
This function is available since SDL 3.2.0.
See also
GetDefaultLogOutputFunction
SetLogOutputFunction

◆ GetLogPriority() [1/2]

LogPriority SDL::GetLogPriority ( int category)
inline

Get the priority of a particular log category.

Parameters
categorythe category to query.
Returns
the LogPriority for the requested category.
Thread safety:
It is safe to call this function from any thread.
Since
This function is available since SDL 3.2.0.
See also
LogCategory.SetLogPriority

◆ GetLogPriority() [2/2]

LogPriority SDL::LogCategory::GetLogPriority ( ) const
inline

Get the priority of a particular log category.

Returns
the LogPriority for the requested category.
Thread safety:
It is safe to call this function from any thread.
Since
This function is available since SDL 3.2.0.
See also
LogCategory.SetLogPriority

◆ Log()

template<class... ARGS>
void SDL::Log ( std::string_view fmt,
ARGS &&... args )
inline

Log a message with LOG_CATEGORY_APPLICATION and LOG_PRIORITY_INFO.

Parameters
fmta std::format/fmt style message format string.
argsadditional parameters matching the {} tokens in the format string, if any.
Thread safety:
It is safe to call this function from any thread.
Since
This function is available since SDL 3.2.0.
Category:
Formatted string
See also
formatted-string
LogUnformatted()
LogCategory.LogCritical
LogCategory.LogDebug
LogCategory.LogError
LogCategory.LogInfo
LogCategory.LogMessage
LogUnformatted
LogCategory.LogTrace
LogCategory.LogVerbose
LogCategory.LogWarn

◆ LogCategory() [1/2]

SDL::LogCategory::LogCategory ( int category)
inlineexplicitconstexpr

Wraps LogCategory.

Parameters
categorythe value to be wrapped

◆ LogCategory() [2/2]

SDL::LogCategory::LogCategory ( LogCategoryRaw category = SDL_LOG_CATEGORY_APPLICATION)
inlineconstexprnoexcept

Wraps LogCategory.

Parameters
categorythe value to be wrapped

◆ LogCritical() [1/2]

template<class... ARGS>
void SDL::LogCategory::LogCritical ( std::string_view fmt,
ARGS &&... args ) const
inline

Log a message with LOG_PRIORITY_CRITICAL.

Parameters
fmta std::format/fmt style message format string.
argsadditional parameters matching the {} tokens in the format string, if any.
Thread safety:
It is safe to call this function from any thread.
Since
This function is available since SDL 3.2.0.
Category:
Formatted string
See also
formatted-string
LogCategory.LogDebug()
LogCategory.LogError()
LogCategory.LogInfo()
LogUnformatted()
LogCategory.LogUnformatted()
LogCategory.LogTrace()
LogCategory.LogVerbose()
LogCategory.LogWarn

◆ LogCritical() [2/2]

template<class... ARGS>
void SDL::LogCritical ( LogCategory category,
std::string_view fmt,
ARGS &&... args )
inline

Log a message with LOG_PRIORITY_CRITICAL.

Parameters
categorythe category of the message.
fmta printf() style message format string.
argsadditional parameters matching % tokens in the fmt string, if any.
Thread safety:
It is safe to call this function from any thread.
Since
This function is available since SDL 3.2.0.
See also
Log
LogCategory.LogDebug
LogCategory.LogError
LogCategory.LogInfo
LogCategory.LogMessage
LogUnformatted
LogCategory.LogTrace
LogCategory.LogVerbose
LogCategory.LogWarn

◆ LogDebug() [1/2]

template<class... ARGS>
void SDL::LogCategory::LogDebug ( std::string_view fmt,
ARGS &&... args ) const
inline

Log a message with LOG_PRIORITY_DEBUG.

Parameters
fmta std::format/fmt style message format string.
argsadditional parameters matching the {} tokens in the format string, if any.
Thread safety:
It is safe to call this function from any thread.
Since
This function is available since SDL 3.2.0.
Category:
Formatted string
See also
LogCategory.LogCritical
LogCategory.LogError
LogCategory.LogInfo
LogCategory.LogMessage
LogUnformatted
LogCategory.LogTrace
LogCategory.LogVerbose
LogCategory.LogWarn

◆ LogDebug() [2/2]

template<class... ARGS>
void SDL::LogDebug ( LogCategory category,
std::string_view fmt,
ARGS &&... args )
inline

Log a message with LOG_PRIORITY_DEBUG.

Parameters
categorythe category of the message.
fmta printf() style message format string.
argsadditional parameters matching % tokens in the fmt string, if any.
Thread safety:
It is safe to call this function from any thread.
Since
This function is available since SDL 3.2.0.
See also
Log
LogCategory.LogCritical
LogCategory.LogError
LogCategory.LogInfo
LogCategory.LogMessage
LogUnformatted
LogCategory.LogTrace
LogCategory.LogVerbose
LogCategory.LogWarn

◆ LogError() [1/2]

template<class... ARGS>
void SDL::LogCategory::LogError ( std::string_view fmt,
ARGS &&... args ) const
inline

Log a message with LOG_PRIORITY_ERROR.

Parameters
fmta std::format/fmt style message format string.
argsadditional parameters matching the {} tokens in the format string, if any.
Thread safety:
It is safe to call this function from any thread.
Since
This function is available since SDL 3.2.0.
Category:
Formatted string
See also
LogCategory.LogCritical
LogCategory.LogDebug
LogCategory.LogInfo
LogCategory.LogMessage
LogUnformatted
LogCategory.LogTrace
LogCategory.LogVerbose
LogCategory.LogWarn

◆ LogError() [2/2]

template<class... ARGS>
void SDL::LogError ( LogCategory category,
std::string_view fmt,
ARGS &&... args )
inline

Log a message with LOG_PRIORITY_ERROR.

Parameters
categorythe category of the message.
fmta printf() style message format string.
argsadditional parameters matching % tokens in the fmt string, if any.
Thread safety:
It is safe to call this function from any thread.
Since
This function is available since SDL 3.2.0.
See also
Log
LogCategory.LogCritical
LogCategory.LogDebug
LogCategory.LogInfo
LogCategory.LogMessage
LogUnformatted
LogCategory.LogTrace
LogCategory.LogVerbose
LogCategory.LogWarn

◆ LogInfo() [1/2]

template<class... ARGS>
void SDL::LogCategory::LogInfo ( std::string_view fmt,
ARGS &&... args ) const
inline

Log a message with LOG_PRIORITY_INFO.

Parameters
fmta std::format/fmt style message format string.
argsadditional parameters matching the {} tokens in the format string, if any.
Thread safety:
It is safe to call this function from any thread.
Since
This function is available since SDL 3.2.0.
Category:
Formatted string
See also
LogCategory.LogCritical
LogCategory.LogDebug
LogCategory.LogError
LogCategory.LogMessage
LogUnformatted
LogCategory.LogTrace
LogCategory.LogVerbose
LogCategory.LogWarn

◆ LogInfo() [2/2]

template<class... ARGS>
void SDL::LogInfo ( LogCategory category,
std::string_view fmt,
ARGS &&... args )
inline

Log a message with LOG_PRIORITY_INFO.

Parameters
categorythe category of the message.
fmta printf() style message format string.
argsadditional parameters matching % tokens in the fmt string, if any.
Thread safety:
It is safe to call this function from any thread.
Since
This function is available since SDL 3.2.0.
See also
Log
LogCategory.LogCritical
LogCategory.LogDebug
LogCategory.LogError
LogCategory.LogMessage
LogUnformatted
LogCategory.LogTrace
LogCategory.LogVerbose
LogCategory.LogWarn

◆ LogMessage() [1/2]

template<class... ARGS>
void SDL::LogCategory::LogMessage ( LogPriority priority,
std::string_view fmt,
ARGS... args ) const
inline

Log a message with the specified priority.

Parameters
prioritythe priority of the message.
fmta std::format/fmt style message format string.
argsadditional parameters matching the {} tokens in the format string, if any.
Thread safety:
It is safe to call this function from any thread.
Since
This function is available since SDL 3.2.0.
Category:
Formatted string
See also
LogCategory.LogCritical
LogCategory.LogDebug
LogCategory.LogError
LogCategory.LogInfo
LogUnformatted
LogCategory.LogTrace
LogCategory.LogVerbose
LogCategory.LogWarn

◆ LogMessage() [2/2]

template<class... ARGS>
void SDL::LogMessage ( LogCategory category,
LogPriority priority,
std::string_view fmt,
ARGS... args )
inline

Log a message with the specified category and priority.

Parameters
categorythe category of the message.
prioritythe priority of the message.
fmta printf() style message format string.
argsadditional parameters matching % tokens in the fmt string, if any.
Thread safety:
It is safe to call this function from any thread.
Since
This function is available since SDL 3.2.0.
See also
Log
LogCategory.LogCritical
LogCategory.LogDebug
LogCategory.LogError
LogCategory.LogInfo
LogUnformatted
LogCategory.LogTrace
LogCategory.LogVerbose
LogCategory.LogWarn

◆ LogTrace() [1/2]

template<class... ARGS>
void SDL::LogCategory::LogTrace ( std::string_view fmt,
ARGS &&... args ) const
inline

Log a message with LOG_PRIORITY_TRACE.

Parameters
fmta std::format/fmt style message format string.
argsadditional parameters matching the {} tokens in the format string, if any.
Thread safety:
It is safe to call this function from any thread.
Since
This function is available since SDL 3.2.0.
Category:
Formatted string
See also
LogCategory.LogCritical
LogCategory.LogDebug
LogCategory.LogError
LogCategory.LogInfo
LogCategory.LogMessage
LogUnformatted
LogCategory.LogVerbose
LogCategory.LogWarn

◆ LogTrace() [2/2]

template<class... ARGS>
void SDL::LogTrace ( LogCategory category,
std::string_view fmt,
ARGS &&... args )
inline

Log a message with LOG_PRIORITY_TRACE.

Parameters
categorythe category of the message.
fmta printf() style message format string.
argsadditional parameters matching % tokens in the fmt string, if any.
Thread safety:
It is safe to call this function from any thread.
Since
This function is available since SDL 3.2.0.
See also
Log
LogCategory.LogCritical
LogCategory.LogDebug
LogCategory.LogError
LogCategory.LogInfo
LogCategory.LogMessage
LogUnformatted
LogCategory.LogTrace
LogCategory.LogVerbose
LogCategory.LogWarn

◆ LogUnformatted() [1/3]

void SDL::LogCategory::LogUnformatted ( LogPriority priority,
StringParam message ) const
inline

Log an unformatted message with the specified priority.

Parameters
prioritythe priority of the message.
messagestring to output.
Thread safety:
It is safe to call this function from any thread.
Since
This function is available since SDL 3.2.0.
See also
SDL::Log()
Log()
LogCritical()
LogDebug()
LogError()
LogInfo()
LogTrace()
LogVerbose()
LogWarn()

◆ LogUnformatted() [2/3]

void SDL::LogUnformatted ( LogCategory category,
LogPriority priority,
StringParam message )
inline

Log an unformatted message with LOG_CATEGORY_APPLICATION and LOG_PRIORITY_INFO.

Parameters
categorythe category of the message.
prioritythe priority of the message.
messagestring to output.
Thread safety:
It is safe to call this function from any thread.
Since
This function is available since SDL 3.2.0.
See also
Log
LogCategory.LogCritical
LogCategory.LogDebug
LogCategory.LogError
LogCategory.LogInfo
LogCategory.LogMessage
LogCategory.LogTrace
LogCategory.LogVerbose
LogCategory.LogWarn

◆ LogUnformatted() [3/3]

void SDL::LogUnformatted ( StringParam message)
inline

Log an unformatted message with LOG_CATEGORY_APPLICATION and LOG_PRIORITY_INFO.

Parameters
messagestring to output.
Thread safety:
It is safe to call this function from any thread.
Since
This function is available since SDL 3.2.0.
See also
Log
LogCategory.LogCritical
LogCategory.LogDebug
LogCategory.LogError
LogCategory.LogInfo
LogCategory.LogMessage
LogCategory.LogVerbose
LogCategory.LogWarn

◆ LogVerbose() [1/2]

template<class... ARGS>
void SDL::LogCategory::LogVerbose ( std::string_view fmt,
ARGS &&... args ) const
inline

Log a message with LOG_PRIORITY_VERBOSE.

Parameters
fmta std::format/fmt style message format string.
argsadditional parameters matching the {} tokens in the format string, if any.
Thread safety:
It is safe to call this function from any thread.
Since
This function is available since SDL 3.2.0.
Category:
Formatted string
See also
LogCategory.LogCritical
LogCategory.LogDebug
LogCategory.LogError
LogCategory.LogInfo
LogCategory.LogMessage
LogUnformatted
LogCategory.LogWarn

◆ LogVerbose() [2/2]

template<class... ARGS>
void SDL::LogVerbose ( LogCategory category,
std::string_view fmt,
ARGS &&... args )
inline

Log a message with LOG_PRIORITY_VERBOSE.

Parameters
categorythe category of the message.
fmta printf() style message format string.
argsadditional parameters matching % tokens in the fmt string, if any.
Thread safety:
It is safe to call this function from any thread.
Since
This function is available since SDL 3.2.0.
See also
Log
LogCategory.LogCritical
LogCategory.LogDebug
LogCategory.LogError
LogCategory.LogInfo
LogCategory.LogMessage
LogUnformatted
LogCategory.LogWarn

◆ LogWarn() [1/2]

template<class... ARGS>
void SDL::LogCategory::LogWarn ( std::string_view fmt,
ARGS &&... args ) const
inline

Log a message with LOG_PRIORITY_WARN.

Parameters
fmta std::format/fmt style message format string.
argsadditional parameters matching the {} tokens in the format string, if any.
Thread safety:
It is safe to call this function from any thread.
Since
This function is available since SDL 3.2.0.
Category:
Formatted string
See also
LogCategory.LogCritical
LogCategory.LogDebug
LogCategory.LogError
LogCategory.LogInfo
LogCategory.LogMessage
LogUnformatted
LogCategory.LogTrace
LogCategory.LogVerbose

◆ LogWarn() [2/2]

template<class... ARGS>
void SDL::LogWarn ( LogCategory category,
std::string_view fmt,
ARGS &&... args )
inline

Log a message with LOG_PRIORITY_WARN.

Parameters
categorythe category of the message.
fmta printf() style message format string.
argsadditional parameters matching % tokens in the fmt string, if any.
Thread safety:
It is safe to call this function from any thread.
Since
This function is available since SDL 3.2.0.
See also
Log
LogCategory.LogCritical
LogCategory.LogDebug
LogCategory.LogError
LogCategory.LogInfo
LogCategory.LogMessage
LogUnformatted
LogCategory.LogTrace
LogCategory.LogVerbose

◆ operator LogCategoryRaw()

SDL::LogCategory::operator LogCategoryRaw ( ) const
inlineconstexprnoexcept

Unwraps to the underlying LogCategory.

Returns
the underlying LogCategoryRaw.

◆ ResetLogOutputFunction()

void SDL::ResetLogOutputFunction ( )
inline

Replace the current log output function with the default one.

Thread safety:
It is safe to call this function from any thread.
Since
This function is available since SDL 3.2.0.
See also
GetDefaultLogOutputFunction
GetLogOutputFunction

◆ ResetLogPriorities()

void SDL::ResetLogPriorities ( )
inline

Reset all priorities to default.

This is called by Quit().

Thread safety:
It is safe to call this function from any thread.
Since
This function is available since SDL 3.2.0.
See also
SetLogPriorities
LogCategory.SetLogPriority

◆ SetLogOutputFunction() [1/2]

void SDL::SetLogOutputFunction ( LogOutputCB callback)
inline

Replace the default log output function with one of your own.

Parameters
callbackan LogOutputFunction to call instead of the default.
Thread safety:
It is safe to call this function from any thread.
Since
This function is available since SDL 3.2.0.
See also
GetDefaultLogOutputFunction
GetLogOutputFunction
ResetLogOutputFunction

◆ SetLogOutputFunction() [2/2]

void SDL::SetLogOutputFunction ( LogOutputFunction callback,
void * userdata )
inline

Replace the default log output function with one of your own.

Parameters
callbackan LogOutputFunction to call instead of the default.
userdataa pointer that is passed to callback.
Thread safety:
It is safe to call this function from any thread.
Since
This function is available since SDL 3.2.0.
See also
GetDefaultLogOutputFunction
GetLogOutputFunction
ResetLogOutputFunction

◆ SetLogPriorities()

void SDL::SetLogPriorities ( LogPriority priority)
inline

Set the priority of all log categories.

Parameters
prioritythe LogPriority to assign.
Thread safety:
It is safe to call this function from any thread.
Since
This function is available since SDL 3.2.0.
See also
ResetLogPriorities
LogCategory.SetLogPriority

◆ SetLogPriority() [1/2]

void SDL::LogCategory::SetLogPriority ( LogPriority priority) const
inline

Set the priority of a particular log category.

Parameters
prioritythe LogPriority to assign.
Thread safety:
It is safe to call this function from any thread.
Since
This function is available since SDL 3.2.0.
See also
LogCategory.GetLogPriority
ResetLogPriorities
SetLogPriorities

◆ SetLogPriority() [2/2]

void SDL::SetLogPriority ( int category,
LogPriority priority )
inline

Set the priority of a particular log category.

Parameters
categorythe category to assign a priority to.
prioritythe LogPriority to assign.
Thread safety:
It is safe to call this function from any thread.
Since
This function is available since SDL 3.2.0.
See also
LogCategory.GetLogPriority
ResetLogPriorities
SetLogPriorities

◆ SetLogPriorityPrefix()

void SDL::SetLogPriorityPrefix ( LogPriority priority,
StringParam prefix )
inline

Set the text prepended to log messages of a given priority.

By default LOG_PRIORITY_INFO and below have no prefix, and LOG_PRIORITY_WARN and higher have a prefix showing their priority, e.g. "WARNING: ".

This function makes a copy of its string argument, prefix, so it is not necessary to keep the value of prefix alive after the call returns.

Parameters
prioritythe LogPriority to modify.
prefixthe prefix to use for that log priority, or nullptr to use no prefix.
Exceptions
Erroron failure.
Thread safety:
It is safe to call this function from any thread.
Since
This function is available since SDL 3.2.0.
See also
SetLogPriorities
LogCategory.SetLogPriority

Variable Documentation

◆ LOG_CATEGORY_APPLICATION

LogCategory SDL::LOG_CATEGORY_APPLICATION
constexpr
Initial value:
=
SDL_LOG_CATEGORY_APPLICATION

APPLICATION.

◆ LOG_CATEGORY_RESERVED10

LogCategory SDL::LOG_CATEGORY_RESERVED10
constexpr
Initial value:
=
SDL_LOG_CATEGORY_RESERVED10

RESERVED10.

◆ LOG_CATEGORY_RESERVED2

LogCategory SDL::LOG_CATEGORY_RESERVED2
constexpr
Initial value:
=
SDL_LOG_CATEGORY_RESERVED2

RESERVED2.

◆ LOG_CATEGORY_RESERVED3

LogCategory SDL::LOG_CATEGORY_RESERVED3
constexpr
Initial value:
=
SDL_LOG_CATEGORY_RESERVED3

RESERVED3.

◆ LOG_CATEGORY_RESERVED4

LogCategory SDL::LOG_CATEGORY_RESERVED4
constexpr
Initial value:
=
SDL_LOG_CATEGORY_RESERVED4

RESERVED4.

◆ LOG_CATEGORY_RESERVED5

LogCategory SDL::LOG_CATEGORY_RESERVED5
constexpr
Initial value:
=
SDL_LOG_CATEGORY_RESERVED5

RESERVED5.

◆ LOG_CATEGORY_RESERVED6

LogCategory SDL::LOG_CATEGORY_RESERVED6
constexpr
Initial value:
=
SDL_LOG_CATEGORY_RESERVED6

RESERVED6.

◆ LOG_CATEGORY_RESERVED7

LogCategory SDL::LOG_CATEGORY_RESERVED7
constexpr
Initial value:
=
SDL_LOG_CATEGORY_RESERVED7

RESERVED7.

◆ LOG_CATEGORY_RESERVED8

LogCategory SDL::LOG_CATEGORY_RESERVED8
constexpr
Initial value:
=
SDL_LOG_CATEGORY_RESERVED8

RESERVED8.

◆ LOG_CATEGORY_RESERVED9

LogCategory SDL::LOG_CATEGORY_RESERVED9
constexpr
Initial value:
=
SDL_LOG_CATEGORY_RESERVED9

RESERVED9.

◆ LOG_PRIORITY_CRITICAL

LogPriority SDL::LOG_PRIORITY_CRITICAL
constexpr
Initial value:
=
SDL_LOG_PRIORITY_CRITICAL

CRITICAL.

◆ LOG_PRIORITY_INVALID

LogPriority SDL::LOG_PRIORITY_INVALID
constexpr
Initial value:
=
SDL_LOG_PRIORITY_INVALID

INVALID.

◆ LOG_PRIORITY_VERBOSE

LogPriority SDL::LOG_PRIORITY_VERBOSE
constexpr
Initial value:
=
SDL_LOG_PRIORITY_VERBOSE

VERBOSE.