Logging & timeSDL 3.2
SDL_Log
Prints a message, printf-style, to wherever this platform shows logs.
Signature
void SDL_Log(const char *fmt, ...);
How it works
It formats like printf (%d, %s, %.2f…) and adds a newline. The difference is where the text goes: the terminal on desktop, the debugger's output window in Visual Studio, logcat on Android. printf would be lost on some of those.
It logs in the APPLICATION category with INFO priority. SDL_LogInfo, SDL_LogError and friends choose the category and priority explicitly.
Parameters
fmtconst char *
A printf format string, followed by its values.
Example
example.cpp
1SDL_Log("window %dx%d, scale %.2f", w, h, SDL_GetWindowDisplayScale(window));
2SDL_Log("SDL_Init failed: %s", SDL_GetError());