nabto_client_set_log_callback()

DESCRIPTION

Set a log callback.

The log callback is called synchronously from the core, this means it is not allowed to call any nabto_client_* functions from the log callback as that would result in a deadlock. If it is needed to react on a log message, a queue is needed such that the invocation of the nabto client SDK can occur from another thread.

To ensure safe operation, always call nabto_client_set_log_callback(client, NULL, NULL) to unregister the log callback before it becomes invalid. This prevents the SDK from attempting to call a function that is no longer valid.

DECLARATION

NABTO_CLIENT_DECL_PREFIX NabtoClientError NABTO_CLIENT_API
nabto_client_set_log_callback(NabtoClient* context, NabtoClientLogCallback callback, void* data)

PARAMETERS

context:
[in] The NabtoClient context to set the log callback on.
callback:
[in] The callback function or NULL to remove the callback.
data:
[in] Passed to the callback along with the log data.

RETURNS

NABTO_CLIENT_EC_OK if ok.