libosmocore  0.9.3
Osmocom core library
Osmocom ringbuffer-backed logging

Files

file  loggingrb.h

Functions

size_t log_target_rb_used_size (struct log_target const *target)
 Return the number of log strings in the osmo_strrb-backed target.
size_t log_target_rb_avail_size (struct log_target const *target)
 Return the capacity of the osmo_strrb-backed target.
const char * log_target_rb_get (struct log_target const *target, size_t logindex)
 Return the nth log entry in a target.
struct log_targetlog_target_create_rb (size_t size)
 Create a new logging target for ringbuffer-backed logging.

Function Documentation

struct log_target* log_target_create_rb ( size_t  size) [read]

Create a new logging target for ringbuffer-backed logging.

Parameters:
[in]sizeThe capacity (number of messages) of the logging target.
Returns:
A log target in case of success, NULL in case of error.

References log_target_create(), log_target_destroy(), LOG_TGT_TYPE_STRRB, osmo_strrb_create(), log_target::output, and log_target::type.

size_t log_target_rb_avail_size ( struct log_target const *  target)

Return the capacity of the osmo_strrb-backed target.

Parameters:
[in]targetThe target to search.

Note that this is the capacity (aka max number of messages). It is not the number of unused message slots.

Returns:
The number of log strings in the osmo_strrb-backed target.

References osmo_strrb::size.

const char* log_target_rb_get ( struct log_target const *  target,
size_t  logindex 
)

Return the nth log entry in a target.

Parameters:
[in]targetThe target to search.
[in]logindexThe index of the log entry/error message.
Returns:
A pointer to the nth message, or NULL if logindex is invalid.

References osmo_strrb_get_nth().

size_t log_target_rb_used_size ( struct log_target const *  target)

Return the number of log strings in the osmo_strrb-backed target.

Parameters:
[in]targetThe target to search.
Returns:
The number of log strings in the osmo_strrb-backed target.

References osmo_strrb_elements().