rpma_log_set_threshold(3)
π 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? useRPMA_LOG_DISABLED. the default value isRPMA_LOG_WARNING.RPMA_LOG_THRESHOLD_AUXβ the auxiliary threshold, meant for use inside the logging function itself (go peek atrpma_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 isRPMA_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 properlyRPMA_LOG_LEVEL_WARNINGβ an error that could be handled in the upper levelRPMA_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 indicationRPMA_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 notRPMA_LOG_THRESHOLDnorRPMA_LOG_THRESHOLD_AUXRPMA_E_INVALβ level is not a value defined byenum rpma_log_leveltypeRPMA_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
- ubuntu noble: librpma-dev 1.3.0-2build2 Β· BSD-3
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms