libsigrokdecode  0.3.0
sigrok protocol decoding library
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions
Logging

Controlling the libsigrokdecode message logging functionality. More...

Functions

int srd_log_loglevel_set (int loglevel)
 Set the libsigrokdecode loglevel. More...
 
int srd_log_loglevel_get (void)
 Get the libsigrokdecode loglevel. More...
 
int srd_log_logdomain_set (const char *logdomain)
 Set the libsigrokdecode logdomain string. More...
 
char * srd_log_logdomain_get (void)
 Get the currently configured libsigrokdecode logdomain. More...
 
int srd_log_callback_set (srd_log_callback cb, void *cb_data)
 Set the libsigrokdecode log callback to the specified function. More...
 
int srd_log_callback_set_default (void)
 Set the libsigrokdecode log callback to the default built-in one. More...
 

Detailed Description

Controlling the libsigrokdecode message logging functionality.

Function Documentation

int srd_log_callback_set ( srd_log_callback  cb,
void *  cb_data 
)

Set the libsigrokdecode 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 libsigrokdecode, 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
SRD_OK upon success, SRD_ERR_ARG upon invalid arguments.
Since
0.3.0

Definition at line 167 of file log.c.

References SRD_ERR_ARG, and SRD_OK.

int srd_log_callback_set_default ( void  )

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

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

Returns
SRD_OK upon success, a (negative) error code otherwise.
Since
0.1.0

Definition at line 191 of file log.c.

References SRD_OK.

char* srd_log_logdomain_get ( void  )

Get the currently configured libsigrokdecode logdomain.

Returns
A copy of the currently configured libsigrokdecode logdomain string. The caller is responsible for g_free()ing the string when it is no longer needed.
Since
0.1.0

Definition at line 146 of file log.c.

int srd_log_logdomain_set ( const char *  logdomain)

Set the libsigrokdecode logdomain string.

Parameters
logdomainThe string to use as logdomain for libsigrokdecode log messages from now on. Must not be NULL. The maximum length of the string is 30 characters (this does not include the trailing NUL-byte). Longer strings are silently truncated. In order to not use a logdomain, pass an empty string. The function makes its own copy of the input string, i.e. the caller does not need to keep it around.
Returns
SRD_OK upon success, SRD_ERR_ARG upon invalid logdomain.
Since
0.1.0

Definition at line 123 of file log.c.

References SRD_ERR_ARG, and SRD_OK.

int srd_log_loglevel_get ( void  )

Get the libsigrokdecode loglevel.

Returns
The currently configured libsigrokdecode loglevel.
Since
0.1.0

Definition at line 102 of file log.c.

int srd_log_loglevel_set ( int  loglevel)

Set the libsigrokdecode loglevel.

This influences the amount of log messages (debug messages, error messages, and so on) libsigrokdecode will output. Using SRD_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 SRD_LOG_DBG for example. Whether this message is shown depends on the (new) loglevel.

Parameters
loglevelThe loglevel to set (SRD_LOG_NONE, SRD_LOG_ERR, SRD_LOG_WARN, SRD_LOG_INFO, SRD_LOG_DBG, or SRD_LOG_SPEW).
Returns
SRD_OK upon success, SRD_ERR_ARG upon invalid loglevel.
Since
0.1.0

Definition at line 81 of file log.c.

References SRD_ERR_ARG, SRD_LOG_SPEW, and SRD_OK.