LOC_SET_LOG_FN(3)

πŸ’… LOC_SET_LOG_FN(3) πŸ’…

ok so we're in the libloc manual, section 3 (library calls, iykyk), and today's main character is loc_set_log_fn. she's tiny, she's iconic, she's gonna make your app's logs actually show up. let's go 🫢


✨ NAME ✨

loc_set_log_fn β€” sets the log callback function πŸ’–


🌸 SYNOPSIS 🌸

#include <libloc/libloc.h>

void loc_set_log_fn(struct loc_ctx* ctx, void (*log_fn)(struct loc_ctx*
ctx, int priority, const char* file, int line, const char* fn, const
char* format, va_list args)

πŸ¦‹ DESCRIPTION πŸ¦‹

okay bestie, listen: libloc doesn't wanna be that friend who just prints stuff to stderr without asking. instead it lets you plug in your own logging system β€” the calling application's logging system, to be exact β€” by setting this callback. so like, it's giving "you do you, I'll just hand you the messages." πŸŽ€

the callback is the log_fn you pass in, and it'll be called once for each log message, according to the configured log level. so no spam, no surprises β€” you get exactly the messages that match whatever log level is set. periodt. ✨


🌈 SEE ALSO 🌈

  • libloc(3) β€” go read the main page, she's the vibe check for the whole library πŸ‘‘

πŸ’œ AUTHORS πŸ’œ

Michael Tremer β€” the icon, the legend, the one who wrote it πŸ«ΆπŸ‘‘


<div align="center">🌸 πŸ¦‹ ✨ πŸŽ€ ✨ πŸ¦‹ 🌸</div>

and that's the whole page, fr fr β€” no cap, no missing options, we ate and left no crumbs πŸ’… this was LOC_SET_LOG_FN(3), living rent free in the libloc section 3 manual, dropping the exact same date and source stamp as the original footer because the facts do not change, only the vibe does πŸ§šπŸ’–

πŸ“¦ where this page comes from