.\" Extracted by src2man from /build/rpma-11eW7Q/rpma-1.3.0/src/include/librpma.h .\" Text automatically generated by txt2man .TH rpma_log_set_function 3 "29 May 2023" "RPMA" "RPMA Programmer's Manual" .SH NAME \fBrpma_log_set_function \fP- set the logging function .SH SYNOPSIS .nf .fam C #include typedef \fIvoid\fP \fBrpma_log_function\fP( enum rpma_log_level \fIlevel\fP, const char *\fIfile_name\fP, const int \fIline_no\fP, const char *\fIfunction_name\fP, const char *\fImessage_format\fP, \.\.\.); int \fBrpma_log_set_function\fP(rpma_log_function *\fIlog_function\fP); .fam T .fi .fam T .fi .SH DESCRIPTION \fBrpma_log_set_function\fP() allows choosing the function which will get all the generated logging messages. The \fIlog_function\fP 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. .PP Parameters of a user-defined log function are as follow: .IP \(bu 3 \fIlevel\fP - the log \fIlevel\fP of the message .IP \(bu 3 \fIfile_name\fP - name of the source file where the message coming from. It could be set to NULL and in such case neither \fIline_no\fP nor \fIfunction_name\fP are provided. .IP \(bu 3 \fIline_no\fP - the source file line where the message coming from .IP \(bu 3 \fIfunction_name\fP - the function name where the message coming from .IP \(bu 3 \fImessage_format\fP - \fBprintf\fP(3)\fB-like\fP format string of the message .IP \(bu 3 "\.\.\." - additional arguments of the message format string .SH THE DEFAULT LOGGING FUNCTION The initial value of the logging function is RPMA_LOG_USE_DEFAULT_FUNCTION. This function writes messages to \fBsyslog\fP(3) (the primary destination) and to \fBstderr\fP(3) (the secondary destination). .SH RETURN VALUE \fBrpma_log_set_function\fP() function returns 0 on success or error code on failure. .SH ERRORS .IP \(bu 3 RPMA_E_AGAIN - a temporary error occurred, the retry may fix the problem .SH NOTE The logging messages on the levels above the RPMA_LOG_THRESHOLD \fIlevel\fP won't trigger the logging function. .PP The user defined function must be thread-safe. .SH SEE ALSO \fBrpma_log_get_threshold\fP(3), \fBrpma_log_set_threshold\fP(3), \fBlibrpma\fP(7) and https://pmem.io/rpma/