libsigrok  unreleased development snapshot
sigrok hardware access and backend library
Functions
Logging

Controlling the libsigrok message logging functionality. More...

Functions

int sr_log_loglevel_set (int loglevel)
 Set the libsigrok loglevel. More...
 
int sr_log_loglevel_get (void)
 Get the libsigrok loglevel. More...
 
int sr_log_callback_set (sr_log_callback cb, void *cb_data)
 Set the libsigrok log callback to the specified function. More...
 
int sr_log_callback_set_default (void)
 Set the libsigrok log callback to the default built-in one. More...
 
int sr_log_callback_get (sr_log_callback *cb, void **cb_data)
 Get the libsigrok log callback routine and callback data. More...
 

Detailed Description

Controlling the libsigrok message logging functionality.

Function Documentation

int sr_log_callback_get ( sr_log_callback cb,
void **  cb_data 
)

Get the libsigrok log callback routine and callback data.

Parameters
[out]cbPointer to a function pointer to receive the log callback function. Optional, can be NULL.
[out]cb_dataPointer to a void pointer to receive the log callback's additional arguments. Optional, can be NULL.
Returns
SR_OK upon success.
Since
0.6.0

Definition at line 175 of file log.c.

References SR_ERR, SR_OK, SR_PRIV, and void().

+ Here is the call graph for this function:

int sr_log_callback_set ( sr_log_callback  cb,
void cb_data 
)

Set the libsigrok log callback to the specified function.

Parameters
cbFunction pointer to the log callback function to use. Must not be NULL.
cb_dataPointer to private data to be passed on. This can be used by the caller to pass arbitrary data to the log functions. This pointer is only stored or passed on by libsigrok, and is never used or interpreted in any way. The pointer is allowed to be NULL if the caller doesn't need/want to pass any data.
Returns
SR_OK upon success, SR_ERR_ARG upon invalid arguments.
Since
0.3.0

Definition at line 127 of file log.c.

References SR_ERR_ARG, and SR_OK.

int sr_log_callback_set_default ( void  )

Set the libsigrok log callback to the default built-in one.

Additionally, the internal 'sr_log_cb_data' pointer is set to NULL.

Returns
SR_OK upon success, a negative error code otherwise.
Since
0.1.0

Definition at line 151 of file log.c.

References SR_OK.

int sr_log_loglevel_get ( void  )

Get the libsigrok loglevel.

Returns
The currently configured libsigrok loglevel.
Since
0.1.0

Definition at line 107 of file log.c.

Referenced by sr_session_stopped_callback_set().

+ Here is the caller graph for this function:

int sr_log_loglevel_set ( int  loglevel)

Set the libsigrok loglevel.

This influences the amount of log messages (debug messages, error messages, and so on) libsigrok will output. Using SR_LOG_NONE disables all messages.

Note that this function itself will also output log messages. After the loglevel has changed, it will output a debug message with SR_LOG_DBG for example. Whether this message is shown depends on the (new) loglevel.

Parameters
loglevelThe loglevel to set (SR_LOG_NONE, SR_LOG_ERR, SR_LOG_WARN, SR_LOG_INFO, SR_LOG_DBG, or SR_LOG_SPEW).
Returns
SR_OK upon success, SR_ERR_ARG upon invalid loglevel.
Since
0.1.0

Definition at line 83 of file log.c.

References SR_ERR_ARG, SR_LOG_SPEW, and SR_OK.