PMEMOBJ_LOG_SET_THRESHOLD(3)
π PMEMOBJ_LOG_SET_THRESHOLD π
okay bestie, welcome to the PMDK Programmer's Manual β¨ you're literally about to learn how to set the logging threshold value, and honestly? it's giving main character energy. no cap, this one's short and sweet. let's go π«Ά
πΈ NAME πΈ
pmemobj_log_set_threshold β set the logging threshold value
β¨ SYNOPSIS β¨
like, here's the whole vibe, verbatim, don't touch it:
#include <libpmemobj.h>
enum pmemobj_log_level {
PMEMOBJ_LOG_LEVEL_HARK,
PMEMOBJ_LOG_LEVEL_FATAL,
PMEMOBJ_LOG_LEVEL_ERROR,
PMEMOBJ_LOG_LEVEL_WARNING,
PMEMOBJ_LOG_LEVEL_NOTICE,
PMEMOBJ_LOG_LEVEL_INFO,
PMEMOBJ_LOG_LEVEL_DEBUG
};
enum pmemobj_log_threshold {
PMEMOBJ_LOG_THRESHOLD,
PMEMOBJ_LOG_THRESHOLD_AUX
};
int pmemobj_log_set_threshold(enum pmemobj_log_threshold threshold,
enum pmemobj_log_level value);
π¦ DESCRIPTION π¦
so pmemobj_log_set_threshold() sets the logging threshold value. that's it. that's the whole job. π
the thresholds you can pick from are:
PMEMOBJ_LOG_THRESHOLDβ this is the main threshold, the one that filters out the logging messages you simply do not want. messages that are less severe than whatever this threshold's value says get ignored, so they never even make it to the logging function (go peek atpmemobj_log_set_function(3)for that whole situation). its default value isPMEMOBJ_LOG_WARNING.PMEMOBJ_LOG_THRESHOLD_AUXβ the auxiliary threshold, made for use inside the logging function (seepmemobj_log_get_threshold(3)if you're nosy π). a custom logging function may or may not care about this threshold, it's fully up to whatever the developer needs. and if you wanna know how the default logging function behaves, that'spmemobj_log_set_function(3)again. its initial value isPMEMOBJ_LOG_LEVEL_HARK.
and the actual threshold values? those come from the enum pmemobj_log_level type. here they are, listed from most severe to least severe, descending order, periodt:
PMEMOBJ_LOG_LEVEL_HARKβ only basic library info. you use this to effectively suppress the logging, because it's only used for a few messages when the program starts up and whenever a new logging function gets set. seepmemobj_log_set_function(3).PMEMOBJ_LOG_LEVEL_FATALβ an error that causes the program to stop working immediately. sorry. πPMEMOBJ_LOG_LEVEL_ERRORβ an error that causes the current operation or transaction to fail.PMEMOBJ_LOG_LEVEL_WARNINGβ an unexpected situation that does NOT cause the current operation to fail. (yes the NOT is loud, it matters.)PMEMOBJ_LOG_LEVEL_NOTICEβ non-massive info, mostly about public API function completions.PMEMOBJ_LOG_LEVEL_INFOβ massive info, like, every single write operation indication. it's a lot. πPMEMOBJ_LOG_LEVEL_DEBUGβ debug info, e.g. a write operation dump.
π RETURN VALUE π
pmemobj_log_set_threshold() returns 0 on success π₯³ or it returns a non-zero value and sets errno on failure. and bestie, on failure, the threshold value stays exactly the way it was β nothing changes, it just says no. π
π₯ ERRORS π₯
pmemobj_log_set_threshold() can set the following errno values when it fails:
EINVALβ threshold is notPMEMOBJ_LOG_THRESHOLDnorPMEMOBJ_LOG_THRESHOLD_AUXEINVALβ value is not defined by theenum pmemobj_log_leveltypeEAGAINβ multiple threads tried to change the threshold value concurrently. a retry may fix the problem. this error is not expected when the function is called from just one thread at a time.
ngl if you're hitting EAGAIN, maybe check who else is in the group chat changing thresholds at the same time π one thread at a time and you're golden.
π SEE ALSO π
pmemobj_log_get_threshold(3), pmemobj_log_set_function(3).
that's the whole page, bestie, you ate it π β¨
PMDK β 2025-07-24 π¦ mwah, go forth and log responsibly π«Άπ
π¦ where this page comes from
- fedora 43: libpmemobj-devel 2.1.0-4.fc43 Β· BSD-3-Clause
- π the page's license: BSD-3-Clause
- Copyright 2024, Intel Corporation
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms