Go to main content

man pages section 3: DAX Library Functions

Exit Print View

Updated: Friday, August 13, 2021
 
 

dax_set_log_callback (3DAX)

Name

dax_set_log_callback - set logging options and callback function

Synopsis

cc [ flag... ] file... -ldax [ library...]

#include <dax.h>

dax_status_t
dax_set_log_callback(dax_context_t *ctx, uint64_t options,
    dax_log_func_t handler, void *cb_data);

Description

This function is similar to the dax_set_log() function, but messages are passed to the callback function specified by handler. The definition of the handler is as follows:

void handler(dax_context_t *ctx, void *cb_data, uint64_t option, 
    char *label, char *msg);

msg is the message to log. libdax frees msg after calling the handler.

cb_data is the same as the cb_data token passed to the dax_set_log_callback() function.

label is a string with further context about the message. The other logging functions print the label and the message, but you can compose a different label. libdax frees the label after the handler is called.

option is the type of message that is logged, and is one of the values of options as defined in the dax_set_log() function. For example, DAX_LOG_ERROR.

Stops sending messages to syslog if dax_set_log() had been called, and stops sending messages to the file descriptor specified by dax_set_log_file() if it had been called.

Continues to send messages enabled by DAX_LOG_OPTIONS to the target defined by the DAX_LOG_OPTIONS and DAX_LOG_FD environment variables at dax_thread_init() time.

The options parameter supports all the values supported by the dax_set_log() function.

Return Values

DAX_SUCCESS

Operation completed successfully

DAX_EINVAL

Unrecognized flag in the options

DAX_ETHREAD

The calling thread did not create ctx

Attributes

See attributes(7) for descriptions of the following attributes:

ATTRIBUTE TYPE
ATTRIBUTE VALUE
Availability
system/library
Interface Stability
Committed

See Also

dax_set_log(3DAX), dax_set_log_file(3DAX), dax_set_log_callback(3DAX)