nabto_device_set_log_callback()
DESCRIPTION
Set log callback if custom logging is desired. The log callback is stored globally, and so, the device reference is unused. This also means if multiple Nabto Device instances is running in the same process, this function configures the callback for all instances. Since the device reference is unused, this function can be called before nabto_device_new()
to enable logging of module initialization, particularly useful when integrating a new embedded platform.
The log callback can be removed by setting the callback and data to NULL.
DECLARATION
NABTO_DEVICE_DECL_PREFIX NabtoDeviceError NABTO_DEVICE_API
nabto_device_set_log_callback(NabtoDevice* device, NabtoDeviceLogCallback cb, void* data)
PARAMETERS
device:
- [in] The device instance to set callback for
cb:
- [in] The function to be called on log event, or NULL to remove
data:
- [in] Void pointer passed to the callback when invoked
RETURNS
NABTO_DEVICE_EC_OK on success