DC_CONTEXT_SET_LOGFUNC(3)

DC_CONTEXT_SET_LOGFUNC(3) | Library Functions Manual | DC_CONTEXT_SET_LOGFUNC(3)

# NAME

`dc_context_set_logfunc` — set the logging function for a dive computer context

# LIBRARY

library “libdivecomputer”

# SYNOPSIS

`#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);

# DESCRIPTION

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`.

# RETURN VALUES

Returns `DC_STATUS_OK` on setting the log level, `DC_STATUS_INVALIDARGS` if context is `NULL`, or another error code on failure.

# SEE ALSO

dc_context_new(3), dc_context_set_loglevel(3)

# AUTHORS

The library “libdivecomputer” library was written by Jef Driesen, jef@libdivecomputer.org. The manpages were written by
Kristaps Dzonsons, kristaps@bsd.lv.

January 5, 2017 | NetBSD 11.0