mco_trace_message_handler_fn Callback

Callback function to handle trace messages.

For an overview see page Tracing Framework in C

When any database operation triggers a trace message a user-define callback function is called which has the following prototype:

    typedef int (*mco_trace_message_handler_fn)(mco_severity severity,
                                mco_trace_module module,
                                const char *file,
                                int line,
                                const char *fmt, ...);

Arguments

severity
The severity level of the message; possible levels (as defined in enum mco_severity) are:
module
The constant describing which eXtremeDB module where tracing is enabled. Modules are defined in enum mco_trace_module.
file
The source code file where tracing has occurred.
line
The source code line where tracing has occurred.
fmt
A printf-like format for messages. Format specifiers are:
...
The arguments for substitution according to the format specification in argument fmt.
    MCO_TRACE_FATAL
    MCO_TRACE_ERROR
    MCO_TRACE_WARNING
    MCO_TRACE_NOTICE
    MCO_TRACE_INFO
    MCO_TRACE_DEBUG
    MCO_TRACE_VERBOSE
    %t - message time
    %m - module
    %i - thread id
    %s - severity
    %f - source code file
    %l - source code line
    %e - error text
    %r - print errno
    %R - print errno with string representation

Description

This callback function is called when any database operation triggers a trace message. Note that this custom handler must be registered with function mco_trace_set_handler().

Return Codes

int
An integer value to indicate success (MCO_S_OK) or an error code.