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:
     
    MCO_TRACE_FATAL
    MCO_TRACE_ERROR
    MCO_TRACE_WARNING
    MCO_TRACE_NOTICE
    MCO_TRACE_INFO
    MCO_TRACE_DEBUG
    MCO_TRACE_VERBOSE 
     

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:

 
    %t - message time
    %m - module
    %i - thread id
    %s - severity
    %f - source code file
    %l - source code line
    %e - error text 
    %r - pring errno
    %R - print errno with string representation
     
... The arguments for substitution according to the format specification in argument fmt

Description

This function is 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