return SRD_OK;
}
+/**
+ * Get the libsigrokdecode log callback routine and callback data.
+ *
+ * @param[out] cb Pointer to a function pointer to receive the log callback
+ * function. Optional, can be NULL.
+ * @param[out] cb_data Pointer to a void pointer to receive the log callback's
+ * additional arguments. Optional, can be NULL.
+ *
+ * @return SRD_OK upon success.
+ *
+ * @since 0.5.2
+ */
+SRD_API int srd_log_callback_get(srd_log_callback *cb, void **cb_data)
+{
+ if (cb)
+ *cb = srd_log_cb;
+ if (cb_data)
+ *cb_data = srd_log_cb_data;
+
+ return SRD_OK;
+}
+
/**
* Set the libsigrokdecode log callback to the default built-in one.
*
/* This specific log callback doesn't need the void pointer data. */
(void)cb_data;
- /* Only output messages of at least the selected loglevel(s). */
- if (loglevel > cur_loglevel)
- return SRD_OK;
+ (void)loglevel;
if (fputs("srd: ", stderr) < 0
|| g_vfprintf(stderr, format, args) < 0
int ret;
va_list args;
+ /* Only output messages of at least the selected loglevel(s). */
+ if (loglevel > cur_loglevel)
+ return SRD_OK;
+
va_start(args, format);
ret = srd_log_cb(srd_log_cb_data, loglevel, format, args);
va_end(args);