[SDL3.1.1]SDL_SetError without output

Why don’t I get any output from the following commands?
SDL_Log() works without any problems.

SDL_SetError("bla bla");
SDL_Error(SDL_ENOMEM);
SDL_InvalidParamError("test");

Because these functions does not output anything. They only serve to update the internal SDL error status. To log this data, you must read it, e.g. using SDL_GetError, and then write it to the output yourself.

Try setting the log priority of the “error category” to debug some point after SDL_Init.

    SDL_LogSetPriority(SDL_LOG_CATEGORY_ERROR, SDL_LOG_PRIORITY_DEBUG);

Otherwise you could use SDL_Log("%s", SDL_GetError()); to output the most recent error.

Thanks, now I understand how this works.

SDL_SetError("Fehler");
SDL_Log(SDL_GetError());
SDL_Error(SDL_ENOMEM);
SDL_Log(SDL_GetError());
SDL_InvalidParamError("test");
SDL_Log(SDL_GetError());

The following example also shows it well.
Should I put it in the wiki?

#include <SDL3/SDL.h>

void * CreateObject()
{
  void * test = nullptr; // as test NULL
  if (!test) {
    SDL_SetError("Couldn't build !");
  }
  return test;
}

int main(int argc, char *argv[])
{
  void * object;
  object = CreateObject();
  if (!object) {
    SDL_Log("Error: %s", SDL_GetError());
  }
}