diff options
-rw-r--r-- | libsigrokdecode.h | 1 | ||||
-rw-r--r-- | log.c | 22 |
2 files changed, 23 insertions, 0 deletions
diff --git a/libsigrokdecode.h b/libsigrokdecode.h index deba470..55620a7 100644 --- a/libsigrokdecode.h +++ b/libsigrokdecode.h @@ -367,6 +367,7 @@ typedef int (*srd_log_callback)(void *cb_data, int loglevel, const char *format, va_list args); SRD_API int srd_log_loglevel_set(int loglevel); SRD_API int srd_log_loglevel_get(void); +SRD_API int srd_log_callback_get(srd_log_callback *cb, void **cb_data); SRD_API int srd_log_callback_set(srd_log_callback cb, void *cb_data); SRD_API int srd_log_callback_set_default(void); @@ -130,6 +130,28 @@ SRD_API int srd_log_callback_set(srd_log_callback cb, void *cb_data) } /** + * 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.6.0 + */ +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. * * Additionally, the internal 'srd_log_cb_data' pointer is set to NULL. |