|
SDL3pp
A slim C++ wrapper for SDL3
|
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. | |
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:
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.
| using SDL::LogOutputCB |
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.
| category | the category of the message. |
| priority | the priority of the message. |
| message | the message being output. |
| using SDL::LogOutputFunction |
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.
| userdata | what was passed as userdata to SetLogOutputFunction(). |
| category | the category of the message. |
| priority | the priority of the message. |
| message | the message being output. |
| using SDL::LogPriority = SDL_LogPriority |
The predefined log priorities.
|
inline |
Get the default log output function.
|
inline |
Get the current log output function.
| callback | an LogOutputFunction filled in with the current log callback. |
| userdata | a pointer filled in with the pointer that is passed to callback. |
|
inline |
Get the priority of a particular log category.
| category | the category to query. |
|
inline |
Get the priority of a particular log category.
|
inline |
Log a message with LOG_CATEGORY_APPLICATION and LOG_PRIORITY_INFO.
| fmt | a std::format/fmt style message format string. |
| args | additional parameters matching the {} tokens in the format string, if any. |
|
inlineexplicitconstexpr |
Wraps LogCategory.
| category | the value to be wrapped |
|
inlineconstexprnoexcept |
Wraps LogCategory.
| category | the value to be wrapped |
|
inline |
Log a message with LOG_PRIORITY_CRITICAL.
| fmt | a std::format/fmt style message format string. |
| args | additional parameters matching the {} tokens in the format string, if any. |
|
inline |
Log a message with LOG_PRIORITY_CRITICAL.
| category | the category of the message. |
| fmt | a printf() style message format string. |
| args | additional parameters matching % tokens in the fmt string, if any. |
|
inline |
Log a message with LOG_PRIORITY_DEBUG.
| fmt | a std::format/fmt style message format string. |
| args | additional parameters matching the {} tokens in the format string, if any. |
|
inline |
Log a message with LOG_PRIORITY_DEBUG.
| category | the category of the message. |
| fmt | a printf() style message format string. |
| args | additional parameters matching % tokens in the fmt string, if any. |
|
inline |
Log a message with LOG_PRIORITY_ERROR.
| fmt | a std::format/fmt style message format string. |
| args | additional parameters matching the {} tokens in the format string, if any. |
|
inline |
Log a message with LOG_PRIORITY_ERROR.
| category | the category of the message. |
| fmt | a printf() style message format string. |
| args | additional parameters matching % tokens in the fmt string, if any. |
|
inline |
Log a message with LOG_PRIORITY_INFO.
| fmt | a std::format/fmt style message format string. |
| args | additional parameters matching the {} tokens in the format string, if any. |
|
inline |
Log a message with LOG_PRIORITY_INFO.
| category | the category of the message. |
| fmt | a printf() style message format string. |
| args | additional parameters matching % tokens in the fmt string, if any. |
|
inline |
Log a message with the specified priority.
| priority | the priority of the message. |
| fmt | a std::format/fmt style message format string. |
| args | additional parameters matching the {} tokens in the format string, if any. |
|
inline |
Log a message with the specified category and priority.
| category | the category of the message. |
| priority | the priority of the message. |
| fmt | a printf() style message format string. |
| args | additional parameters matching % tokens in the fmt string, if any. |
|
inline |
Log a message with LOG_PRIORITY_TRACE.
| fmt | a std::format/fmt style message format string. |
| args | additional parameters matching the {} tokens in the format string, if any. |
|
inline |
Log a message with LOG_PRIORITY_TRACE.
| category | the category of the message. |
| fmt | a printf() style message format string. |
| args | additional parameters matching % tokens in the fmt string, if any. |
|
inline |
Log an unformatted message with the specified priority.
| priority | the priority of the message. |
| message | string to output. |
|
inline |
Log an unformatted message with LOG_CATEGORY_APPLICATION and LOG_PRIORITY_INFO.
| category | the category of the message. |
| priority | the priority of the message. |
| message | string to output. |
|
inline |
Log an unformatted message with LOG_CATEGORY_APPLICATION and LOG_PRIORITY_INFO.
| message | string to output. |
|
inline |
Log a message with LOG_PRIORITY_VERBOSE.
| fmt | a std::format/fmt style message format string. |
| args | additional parameters matching the {} tokens in the format string, if any. |
|
inline |
Log a message with LOG_PRIORITY_VERBOSE.
| category | the category of the message. |
| fmt | a printf() style message format string. |
| args | additional parameters matching % tokens in the fmt string, if any. |
|
inline |
Log a message with LOG_PRIORITY_WARN.
| fmt | a std::format/fmt style message format string. |
| args | additional parameters matching the {} tokens in the format string, if any. |
|
inline |
Log a message with LOG_PRIORITY_WARN.
| category | the category of the message. |
| fmt | a printf() style message format string. |
| args | additional parameters matching % tokens in the fmt string, if any. |
|
inlineconstexprnoexcept |
Unwraps to the underlying LogCategory.
|
inline |
Replace the current log output function with the default one.
|
inline |
|
inline |
Replace the default log output function with one of your own.
| callback | an LogOutputFunction to call instead of the default. |
|
inline |
Replace the default log output function with one of your own.
| callback | an LogOutputFunction to call instead of the default. |
| userdata | a pointer that is passed to callback. |
|
inline |
Set the priority of all log categories.
| priority | the LogPriority to assign. |
|
inline |
Set the priority of a particular log category.
| priority | the LogPriority to assign. |
|
inline |
Set the priority of a particular log category.
| category | the category to assign a priority to. |
| priority | the LogPriority to assign. |
|
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.
| priority | the LogPriority to modify. |
| prefix | the prefix to use for that log priority, or nullptr to use no prefix. |
| Error | on failure. |
|
constexpr |
APPLICATION.
|
constexpr |
RESERVED10.
|
constexpr |
RESERVED2.
|
constexpr |
RESERVED3.
|
constexpr |
RESERVED4.
|
constexpr |
RESERVED5.
|
constexpr |
RESERVED6.
|
constexpr |
RESERVED7.
|
constexpr |
RESERVED8.
|
constexpr |
RESERVED9.
|
constexpr |
CRITICAL.
|
constexpr |
INVALID.
|
constexpr |
VERBOSE.