dc_context_set_logfunc
—
set the logging function for a dive computer
context
library
“libdivecomputer”
#include
<libdivecomputer/context.h>
typedef void
(*dc_logfunc_t)
(dc_context_t
*context, dc_loglevel_t loglevel,
const char *file, unsigned int
line, const char *function,
const char *message, void
*userdata);
dc_status_t
dc_context_set_logfunc
(dc_context_t
*context, dc_logfunc_t logfunc,
void *userdata);
Set the logging function logfunc associated
with a dive computer context. The logging function is invoked with argument
userdata when the log level (see
dc_context_set_loglevel(3))
has been exceeded.
The logfunc accepts the following
values:
- context
- The context in which it was invoked.
- loglevel
- The level of the log message.
- file
- The source file where the message was raised.
- line
- The source line (from 1) where the message was raised.
- function
- The function that raised the log message.
- message
- The log message itself.
- userdata
- The pointer passed to
dc_context_set_logfunc
.
Returns DC_STATUS_OK
on setting the log
level, DC_STATUS_INVALIDARGS
if
context is NULL
, or another
error code on failure.