SDL3pp
A slim C++ wrapper for SDL3
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
SDL::LogCategory Class Reference

The predefined log categories. More...

Public Member Functions

constexpr LogCategory (int category)
 Constructor from int.
 
constexpr LogCategory (SDL_LogCategory category=SDL_LOG_CATEGORY_APPLICATION)
 Constructor from SDL_LogCategory.
 
constexpr operator int ()
 Conversion operator to int.
 
constexpr operator SDL_LogCategory ()
 Conversion operator to SDL_LogCategory.
 
constexpr auto operator<=> (const LogCategory &other) const =default
 Comparison operator.
 
void SetLogPriority (LogPriority priority)
 Set the priority of a particular log category.
 
LogPriority GetLogPriority () const
 Get the priority of a particular log category.
 
void LogUnformatted (LogPriority priority, StringParam message) const
 Log an unformatted message with the specified priority.
 
template<class... ARGS>
void Log (LogPriority priority, std::string_view fmt, ARGS... args) const
 Log a message with the specified priority.
 
template<class... ARGS>
void LogTrace (std::string_view fmt, ARGS &&... args) const
 Log a message with SDL_LOG_PRIORITY_TRACE.
 
template<class... ARGS>
void LogVerbose (std::string_view fmt, ARGS &&... args) const
 Log a message with SDL_LOG_PRIORITY_VERBOSE.
 
template<class... ARGS>
void LogDebug (std::string_view fmt, ARGS &&... args) const
 Log a message with SDL_LOG_PRIORITY_DEBUG.
 
template<class... ARGS>
void LogInfo (std::string_view fmt, ARGS &&... args) const
 Log a message with SDL_LOG_PRIORITY_INFO.
 
template<class... ARGS>
void LogWarn (std::string_view fmt, ARGS &&... args) const
 Log a message with SDL_LOG_PRIORITY_WARN.
 
template<class... ARGS>
void LogError (std::string_view fmt, ARGS &&... args) const
 Log a message with SDL_LOG_PRIORITY_ERROR.
 
template<class... ARGS>
void LogCritical (std::string_view fmt, ARGS &&... args) const
 Log a message with SDL_LOG_PRIORITY_CRITICAL.
 

Static Public Member Functions

static void SetLogPriorities (LogPriority priority)
 Set the priority of all log categories.
 
static void ResetLogPriorities ()
 Reset all priorities to default.
 

Detailed Description

By default the application and gpu categories are enabled at the INFO level, the assert category is enabled at the WARN level, test is enabled at the VERBOSE level and all other categories are enabled at the ERROR level.

Since
This enum is available since SDL 3.2.0.
Category:
Wrap state
See also
wrap-state

Member Function Documentation

◆ GetLogPriority()

LogPriority SDL::LogCategory::GetLogPriority ( ) const
inline
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
SetLogPriority()

◆ Log()

template<class... ARGS>
void SDL::LogCategory::Log ( LogPriority  priority,
std::string_view  fmt,
ARGS...  args 
) const
inline
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
formatted-string
SDL::Log()
LogUnformatted()
LogCritical()
LogDebug()
LogError()
LogInfo()
LogTrace()
LogVerbose()
LogWarn()

◆ LogCritical()

template<class... ARGS>
void SDL::LogCategory::LogCritical ( std::string_view  fmt,
ARGS &&...  args 
) const
inline
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
SDL::Log()
LogDebug()
LogError()
LogInfo()
Log()
LogUnformatted()
LogTrace()
LogVerbose()
LogWarn()

◆ LogDebug()

template<class... ARGS>
void SDL::LogCategory::LogDebug ( std::string_view  fmt,
ARGS &&...  args 
) const
inline
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
SDL::Log()
LogCritical()
LogError()
LogInfo()
Log()
LogUnformatted()
LogTrace()
LogVerbose()
LogWarn()

◆ LogError()

template<class... ARGS>
void SDL::LogCategory::LogError ( std::string_view  fmt,
ARGS &&...  args 
) const
inline
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
SDL::Log()
LogCritical()
LogDebug()
LogInfo()
Log()
LogUnformatted()
LogTrace()
LogVerbose()
LogWarn()

◆ LogInfo()

template<class... ARGS>
void SDL::LogCategory::LogInfo ( std::string_view  fmt,
ARGS &&...  args 
) const
inline
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
SDL::Log()
LogCritical()
LogDebug()
LogError()
Log()
LogUnformatted()
LogTrace()
LogVerbose()
LogWarn()

◆ LogTrace()

template<class... ARGS>
void SDL::LogCategory::LogTrace ( std::string_view  fmt,
ARGS &&...  args 
) const
inline
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
SDL::Log()
LogCritical()
LogDebug()
LogError()
LogInfo()
Log()
LogUnformatted()
LogVerbose()
LogWarn()

◆ LogUnformatted()

void SDL::LogCategory::LogUnformatted ( LogPriority  priority,
StringParam  message 
) const
inline
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()

◆ LogVerbose()

template<class... ARGS>
void SDL::LogCategory::LogVerbose ( std::string_view  fmt,
ARGS &&...  args 
) const
inline
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
SDL::Log()
LogCritical()
LogDebug()
LogError()
LogInfo()
Log()
LogUnformatted()
LogTrace()
LogWarn()

◆ LogWarn()

template<class... ARGS>
void SDL::LogCategory::LogWarn ( std::string_view  fmt,
ARGS &&...  args 
) const
inline
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
SDL::Log()
LogCritical()
LogDebug()
LogError()
LogInfo()
Log()
LogUnformatted()
LogTrace()
LogVerbose()

◆ ResetLogPriorities()

static void SDL::LogCategory::ResetLogPriorities ( )
inlinestatic

This is called by SDL_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
SetLogPriority

◆ SetLogPriorities()

static void SDL::LogCategory::SetLogPriorities ( LogPriority  priority)
inlinestatic
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()
SetLogPriority()

◆ SetLogPriority()

void SDL::LogCategory::SetLogPriority ( LogPriority  priority)
inline
Parameters
prioritythe SDL_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
GetLogPriority()
ResetLogPriorities()
SetLogPriorities()

The documentation for this class was generated from the following file: