rpma_log_set_function(3) RPMA Programmer's Manual rpma_log_set_function(3)

rpma_log_set_function - set the logging function

      #include <librpma.h>
      typedef void rpma_log_function(
              enum rpma_log_level level,
              const char *file_name,
              const int line_no,
              const char *function_name,
              const char *message_format,
              ...);
      int rpma_log_set_function(rpma_log_function *log_function);

rpma_log_set_function() allows choosing the function which will get all the generated logging messages. The log_function can be either RPMA_LOG_USE_DEFAULT_FUNCTION which will use the default logging function (built into the library) or a pointer to a user-defined function.

Parameters of a user-defined log function are as follow:

The initial value of the logging function is RPMA_LOG_USE_DEFAULT_FUNCTION. This function writes messages to syslog(3) (the primary destination) and to stderr(3) (the secondary destination).

rpma_log_set_function() function returns 0 on success or error code on failure.

RPMA_E_AGAIN - a temporary error occurred, the retry may fix the problem

The logging messages on the levels above the RPMA_LOG_THRESHOLD level won't trigger the logging function.

The user defined function must be thread-safe.

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

29 October 2024 RPMA