OpenOCD
jtag/drivers/libjaylink/libjaylink/log.c File Reference

Logging functions. More...

Include dependency graph for jtag/drivers/libjaylink/libjaylink/log.c:

Go to the source code of this file.

Functions

JAYLINK_API const char * jaylink_log_get_domain (const struct jaylink_context *ctx)
 Get the libjaylink log domain. More...
 
JAYLINK_API int jaylink_log_get_level (const struct jaylink_context *ctx, enum jaylink_log_level *level)
 Get the libjaylink log level. More...
 
JAYLINK_API int jaylink_log_set_callback (struct jaylink_context *ctx, jaylink_log_callback callback, void *user_data)
 Set the libjaylink log callback function. More...
 
JAYLINK_API int jaylink_log_set_domain (struct jaylink_context *ctx, const char *domain)
 Set the libjaylink log domain. More...
 
JAYLINK_API int jaylink_log_set_level (struct jaylink_context *ctx, enum jaylink_log_level level)
 Set the libjaylink log level. More...
 

Detailed Description

Logging functions.

Definition in file jtag/drivers/libjaylink/libjaylink/log.c.

Function Documentation

◆ jaylink_log_get_domain()

JAYLINK_API const char* jaylink_log_get_domain ( const struct jaylink_context ctx)

Get the libjaylink log domain.

Parameters
[in]ctxlibjaylink context.
Returns
A string which contains the current log domain on success, or NULL on failure. The string is null-terminated and must not be free'd by the caller.
Since
0.1.0

Definition at line 161 of file jtag/drivers/libjaylink/libjaylink/log.c.

References jaylink_context::log_domain, and NULL.

◆ jaylink_log_get_level()

JAYLINK_API int jaylink_log_get_level ( const struct jaylink_context ctx,
enum jaylink_log_level level 
)

Get the libjaylink log level.

Parameters
[in]ctxlibjaylink context.
[out]levelLog level on success, and undefined on failure.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
Since
0.1.0

Definition at line 72 of file jtag/drivers/libjaylink/libjaylink/log.c.

References JAYLINK_ERR_ARG, JAYLINK_OK, and jaylink_context::log_level.

◆ jaylink_log_set_callback()

JAYLINK_API int jaylink_log_set_callback ( struct jaylink_context ctx,
jaylink_log_callback  callback,
void *  user_data 
)

Set the libjaylink log callback function.

Parameters
[in,out]ctxlibjaylink context.
[in]callbackCallback function to use, or NULL to use the default log function.
[in]user_dataUser data to be passed to the callback function.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
Since
0.1.0

Definition at line 96 of file jtag/drivers/libjaylink/libjaylink/log.c.

References JAYLINK_ERR_ARG, JAYLINK_OK, jaylink_context::log_callback, jaylink_context::log_callback_data, log_vprintf(), and NULL.

Referenced by jlink_init().

◆ jaylink_log_set_domain()

JAYLINK_API int jaylink_log_set_domain ( struct jaylink_context ctx,
const char *  domain 
)

Set the libjaylink log domain.

The log domain is a string which is used as prefix for all log messages to differentiate them from messages of other libraries.

The maximum length of the log domain is JAYLINK_LOG_DOMAIN_MAX_LENGTH bytes, excluding the trailing null-terminator. A log domain which exceeds this length will be silently truncated.

Parameters
[in,out]ctxlibjaylink context.
[in]domainLog domain to use. To set the default log domain, use JAYLINK_LOG_DOMAIN_DEFAULT.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
JAYLINK_ERROther error conditions.
Since
0.1.0

Definition at line 133 of file jtag/drivers/libjaylink/libjaylink/log.c.

References JAYLINK_ERR, JAYLINK_ERR_ARG, JAYLINK_LOG_DOMAIN_MAX_LENGTH, JAYLINK_OK, and jaylink_context::log_domain.

Referenced by jaylink_init().

◆ jaylink_log_set_level()

JAYLINK_API int jaylink_log_set_level ( struct jaylink_context ctx,
enum jaylink_log_level  level 
)

Set the libjaylink log level.

Parameters
[in,out]ctxlibjaylink context.
[in]levelLog level to set.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
Since
0.1.0

Definition at line 47 of file jtag/drivers/libjaylink/libjaylink/log.c.

References JAYLINK_ERR_ARG, JAYLINK_LOG_LEVEL_DEBUG_IO, JAYLINK_OK, and jaylink_context::log_level.