Logging & timeSDL 3.2

SDL_SetLogPriority

Sets the lowest priority that is still printed for one category.

Signature

void SDL_SetLogPriority(int category, SDL_LogPriority priority);

How it works

By default your application category shows INFO and above, so SDL_LogDebug messages are hidden. Lower the level to DEBUG while developing, raise it to WARN for a release. SDL_SetLogPriorities sets every category at once.

Parameters

categoryint

The category to change.

prioritySDL_LogPriority

The new minimum.

Common values

SDL_LOG_PRIORITY_VERBOSE / _DEBUG
Everything, for development.
SDL_LOG_PRIORITY_INFO
Normal messages and up.
SDL_LOG_PRIORITY_WARN / _ERROR / _CRITICAL
Only problems.

Example

example.cpp
1#ifndef NDEBUG
2SDL_SetLogPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_DEBUG);
3#endif
4SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "player at %.1f, %.1f", x, y);
Official SDL wiki