DC_CONTEXT_SET_LOGFUNC(3)

πŸ“¦ version 0.9.0, in nixos 26.05, nixpkgs unstable

πŸ’… DC_CONTEXT_SET_LOGFUNC β€” bestie, it's giving "set the logging function" energy

okay so this is a libdivecomputer manpage, page DC_CONTEXT_SET_LOGFUNC(3), and it's literally about plugging your own log function into a dive computer context. sit with me, we're doing this 🫢

✨ NAME ✨

dc_context_set_logfunc β€” set the logging function for a dive computer context. that's it. that's the vibe. πŸŽ€

πŸ“š LIBRARY πŸ“š

library β€œlibdivecomputer” β€” yes queen, that one πŸ’–

🌸 SYNOPSIS 🌸

#include <libdivecomputer/context.h>

typedef void
(*dc_logfunc_t)(dc_context_t *context, dc_loglevel_t loglevel,
    const char *file, unsigned int line, const char *function,
    const char *message, void *userdata);

dc_status_t
dc_context_set_logfunc(dc_context_t *context, dc_logfunc_t logfunc,
    void *userdata);

copy it exactly, bestie, no cap ✨

🌈 DESCRIPTION 🌈

so what we're doing here is setting the logging function logfunc that's associated with a dive computer context. main character behavior honestly πŸ‘‘

here's the tea: the logging function gets invoked with the argument userdata when the log level (peep dc_context_set_loglevel(3) if you wanna know more) has been exceeded. iykyk πŸ’…

the logfunc accepts the following values, and you're gonna wanna know every single one of them, fr fr:

  • context β€” the context in which it was invoked. literally the context, that's the whole thing πŸ¦‹
  • loglevel β€” the level of the log message. how serious are we talking πŸ”₯
  • file β€” the source file where the message was raised. snitching on itself, love that for it πŸ’€
  • line β€” the source line (from 1) where the message was raised. counting from 1, not 0, don't @ me
  • function β€” the function that raised the log message. names names πŸ“›
  • message β€” the log message itself. the actual words πŸ’¬
  • userdata β€” the pointer passed to dc_context_set_logfunc. your little bonus gift, you're welcome 🎁

🫢 RETURN VALUES 🫢

  • Returns DC_STATUS_OK on setting the log level β€” slay ✨
  • Returns DC_STATUS_INVALIDARGS if context is NULL β€” yeah, that'll happen 😭
  • or another error code on failure β€” it happens to the best of us, no biggie πŸ’œ

πŸ‘€ SEE ALSO πŸ‘€

go read them, they're iconic too 🌟

🧚 AUTHORS 🧚

the library β€œlibdivecomputer” library was written by Jef Driesen, jef@libdivecomputer.org β€” king behavior πŸ‘‘ the manpages were written by Kristaps Dzonsons, kristaps@bsd.lv β€” also king behavior, we stan 🌸


and that's the whole page, bestie!! πŸŽ€ this one came from the Debian crew, dated January 5, 2017, and it's the DC_CONTEXT_SET_LOGFUNC(3) page β€” periodt. go forth and log responsibly πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from