rpma_log_set_threshold(3)

πŸ“¦
version 1.3.0 Β· 3 versions
, in ubuntu noble

πŸ’– rpma_log_set_threshold(3) πŸ’–

okay so bestie, we're in the RPMA Programmer's Manual rn and this page is all about rpma_log_set_threshold β€” the lil function that decides how loud your library is allowed to be. if you've ever wanted to mute the drama or turn the volume ALL the way up, this is your girl. let's get into it πŸŽ€


✨ NAME ✨

rpma_log_set_threshold β€” set the logging threshold level 🌸


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <librpma.h>

int rpma_log_set_threshold(enum rpma_log_threshold threshold, enum rpma_log_level level);

enum rpma_log_level {
        RPMA_LOG_DISABLED,
        RPMA_LOG_LEVEL_FATAL,
        RPMA_LOG_LEVEL_ERROR,
        RPMA_LOG_LEVEL_WARNING,
        RPMA_LOG_LEVEL_NOTICE,
        RPMA_LOG_LEVEL_INFO,
        RPMA_LOG_LEVEL_DEBUG,
};

enum rpma_log_threshold {
        RPMA_LOG_THRESHOLD,
        RPMA_LOG_THRESHOLD_AUX,
        RPMA_LOG_THRESHOLD_MAX
};

πŸ’… DESCRIPTION πŸ’…

rpma_log_set_threshold() sets the logging threshold level. that's it, that's the whole job. she sets the vibe check for your logs ✨

here are the thresholds you can pick from:

  • RPMA_LOG_THRESHOLD β€” the main threshold, the one that filters out the logging messages you don't wanna see. any message on a level higher than the primary threshold level just gets ignored, no cap. and if you wanna suppress logging entirely? use RPMA_LOG_DISABLED. the default value is RPMA_LOG_WARNING.
  • RPMA_LOG_THRESHOLD_AUX β€” the auxiliary threshold, meant for use inside the logging function itself (go peek at rpma_log_get_threshold(3) for that tea πŸ“). whether the logging function actually takes this threshold into consideration is lowkey up to it β€” it may or may not. the default value is RPMA_LOG_DISABLED.

and the available threshold levels are defined by enum rpma_log_level:

  • RPMA_LOG_DISABLED β€” all messages will be suppressed 🀫
  • RPMA_LOG_LEVEL_FATAL β€” an error that causes the library to stop working immediately πŸ˜­πŸ’€
  • RPMA_LOG_LEVEL_ERROR β€” an error that causes the library to stop working properly
  • RPMA_LOG_LEVEL_WARNING β€” an error that could be handled in the upper level
  • RPMA_LOG_LEVEL_NOTICE β€” non-massive info, mainly related to public API function completions, e.g. connection established 🫢
  • RPMA_LOG_LEVEL_INFO β€” massive info, e.g. every write operation indication
  • RPMA_LOG_LEVEL_DEBUG β€” debug info, e.g. write operation dump πŸ”

🌈 THE DEFAULT LOGGING FUNCTION 🌈

the default logging function writes messages to syslog(3) and to stderr(3). and here's the mapping, bestie, write it down: syslog(3) is the primary destination (so RPMA_LOG_THRESHOLD applies to it), whereas stderr(3) is the secondary destination (so RPMA_LOG_THRESHOLD_AUX applies to it). two destinations, two thresholds, main character energy fr fr πŸ’…


⭐ RETURN VALUE ⭐

rpma_log_syslog_set_threshold() function returns 0 on success or a negative error code on failure.


🚨 ERRORS 🚨

rpma_log_set_threshold() can fail with the following errors:

  • RPMA_E_INVAL β€” threshold is not RPMA_LOG_THRESHOLD nor RPMA_LOG_THRESHOLD_AUX
  • RPMA_E_INVAL β€” level is not a value defined by enum rpma_log_level type
  • RPMA_E_AGAIN β€” a temporary error occurred, the retry may fix the problem πŸ™ˆ
bestie pls note: RPMA_E_AGAIN is giving "just try again", not "give up". retry it πŸ’œ

πŸ‘‘ SEE ALSO πŸ‘‘

rpma_log_get_threshold(3), rpma_log_set_function(3), librpma(7) and https://pmem.io/rpma/


and that's the whole page, periodt ✨ this was RPMA, from the 01 April 2024 era, and yes we ate πŸ“πŸ’– bye bestie, go set some thresholds πŸ¦‹

πŸ“¦ where this page comes from