gensio_set_log_mask(3)

πŸ’– gensio_set_log_mask β€” bestie's guide to gensio logging πŸ’–

okay so welcome to the gensio_set_log_mask(3) page, aka the Library Functions Manual entry that's gonna teach you how to control which gensio logs get through and which ones get ghosted. πŸ‘» this is your group chat for logging, and you're the admin with the mute button. let's gooo 🫢


✨ NAME ✨

gensio_set_log_mask, gensio_get_log_mask, gensio_log_level_to_str, β€” the whole little friend group whose job is logging and setting which gensio logs are passed or ignored. like, who gets to speak, and who's on read. πŸ’…


🌸 SYNOPSIS 🌸

#include <gensio/gensio.h>

void gensio_set_log_mask(unsigned int mask);

unsigned int gensio_get_log_mask(void);

const char *gensio_log_level_to_str(enum gensio_log_levels level);

void gensio_vlog(struct gensio_os_funcs *o,
                    enum gensio_log_levels level,
                    const char *str, va_list args);

void gensio_log(struct gensio_os_funcs *o,
                    enum gensio_log_levels level,
                    const char *str, ...);

no cap, that's the whole lineup. ✨


πŸ¦‹ DESCRIPTION πŸ¦‹

so the log mask is a global variable in the gensio library, and its whole main character job is setting what level of logs are delivered through the vlog function pointer in gensio_os_funcs. it's literally the bouncer at the club. πŸŽ€

the log levels are, in order:

GENSIO_LOG_FATAL GENSIO_LOG_ERR GENSIO_LOG_WARNING
GENSIO_LOG_INFO GENSIO_LOG_DEBUG

and yeah, with obvious meanings β€” fatal is the "omg everything is on fire 😭" one and debug is the "hi bestie here's every tiny detail" one. iykyk.

there's also this one:

GENSIO_LOG_MASK_ALL

which is a bitmask of all the log levels β€” the "let everybody talk, i want chaos" option 🌈.

the default log mask is (1 << GENSIO_LOG_FATAL | 1 << GENSIO_LOG_ERR). so by default it's just the fatal and err girlies getting through. the rest are muted. 🀐

setting other log values can be helpful in debugging problems with gensios. so when something's acting up, turn up the volume, bestie. πŸ”₯

now the functions, one by one:

  • gensio_log_level_to_str β€” converts a log level to a string representation of that level. it's giving "translate the vibe into words". πŸ’¬
  • gensio_vlog and gensio_log β€” these are the functions used to generate logs. and listen, these are primarily for use in the gensio library, though you may use them, too, if you like. no gatekeeping here, you're welcome to pull up. 🫢

πŸ‘‘ SEE ALSO πŸ‘‘


and that's the whole page, bestie, you ate it. πŸ’…βœ¨ this was the Library Functions Manual moment, dated 23 Feb 2019, straight from the gensio_set_log_mask(3) page itself. go forth and control your logs, icon. πŸŽ€πŸ¦‹πŸ’–

πŸ“¦ where this page comes from