SDL_SetLogPriorityPrefix(3)
π SDL_SetLogPriorityPrefix β the SDL3 glow-up for your log messages π
okay bestie, welcome to the SDL3 FUNCTIONS section of the manual, and today we're doing a little β¨aestheticβ¨ upgrade to your logs. this one's called SDL_SetLogPriorityPrefix, and no cap, it's the glow-up your terminal output has been begging for π
πΈ NAME πΈ
SDL_SetLogPriorityPrefix β sets the text that gets prepended to log messages of a given priority. like, the little label that shows up in front of the drama. π
β¨ SYNOPSIS β¨
#include <SDL3/SDL_log.h>
bool SDL_SetLogPriorityPrefix(SDL_LogPriority priority, const char *prefix);
π¦ DESCRIPTION π¦
so here's the tea β β by default, SDL_LOG_PRIORITY_INFO and anything below it get no prefix at all, and SDL_LOG_PRIORITY_WARN and anything higher get a prefix showing off their priority, like "WARNING: ". main character energy, honestly.
this function lets you change that prefix for whichever priority you want.
and the bestie behavior? π«Ά this function makes a copy of its string argument, prefix, so you do not need to keep the value of prefix alive after the call returns. it's giving responsible. it's giving self-sufficient. it's giving you can let that buffer go, queen.
π FUNCTION PARAMETERS π
priorityβ theSDL_LogPriorityyou wanna modify. pick your fighter πprefixβ the prefix to use for that log priority, orNULLto use no prefix. yes,NULLis a valid vibe, that's the "silent but deadly" option π
π₯ RETURN VALUE π₯
returns true on success or false on failure β and if it fails, call SDL_GetError() for more information. literally always check, bestie, don't just assume it ate π
π THREAD SAFETY π
it is safe to call this function from any thread. go off, multithreaded icon π
β AVAILABILITY β
this function is available since SDL 3.2.0. so if you're on something older... babes. time to update. π§
π SEE ALSO π
ngl, prefixing your logs is lowkey the most underrated self-care. your future self reading a crash log at 3am will thank you π
and that's the whole page, bestie!! this lil slice of SDL 3.4.18 knowledge comes to you courtesy of Simple Directmedia Layer β stay logged, stay iconic, and may all your priorities have the cutest prefixes πΈβ¨π
π¦ where this page comes from
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms