libosmocore 1.10.0.57-8972
Osmocom core library
|
This adds a log which consist of an in-memory ring buffer. More...
Files | |
file | loggingrb.h |
file | loggingrb.c |
Ringbuffer-backed logging support code. | |
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. More... | |
size_t | log_target_rb_avail_size (struct log_target const *target) |
Return the capacity of the osmo_strrb-backed target. More... | |
const char * | log_target_rb_get (struct log_target const *target, size_t logindex) |
Return the nth log entry in a target. More... | |
struct log_target * | log_target_create_rb (size_t size) |
Create a new logging target for ringbuffer-backed logging. More... | |
static void | _rb_output (struct log_target *target, unsigned int level, const char *log) |
This adds a log which consist of an in-memory ring buffer.
The idea is that the user can configure his logging in a way that critical messages get stored in the ring buffer, and that the last few critical messages can then always obtained by dumping the ring buffer. It can hence be used as a more generic version of the "show me the last N alarms" functionality.
|
static |
References osmo_strrb_add(), log_target::rb, and log_target::tgt_rb.
Referenced by log_target_create_rb().
struct log_target * log_target_create_rb | ( | size_t | size | ) |
Create a new logging target for ringbuffer-backed logging.
[in] | size | The capacity (number of messages) of the logging target. |
References _rb_output(), log_target_create(), log_target_destroy(), LOG_TGT_TYPE_STRRB, osmo_strrb_create(), log_target::output, log_target::rb, osmo_strrb::size, log_target::tgt_rb, 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.
[in] | target | The target to search. |
Note that this is the capacity (aka max number of messages). It is not the number of unused message slots.
References log_target::rb, osmo_strrb::size, and log_target::tgt_rb.
const char * log_target_rb_get | ( | struct log_target const * | target, |
size_t | logindex | ||
) |
Return the nth log entry in a target.
[in] | target | The target to search. |
[in] | logindex | The index of the log entry/error message. |
References osmo_strrb_get_nth(), log_target::rb, and log_target::tgt_rb.
size_t log_target_rb_used_size | ( | struct log_target const * | target | ) |
Return the number of log strings in the osmo_strrb-backed target.
[in] | target | The target to search. |
References osmo_strrb_elements(), log_target::rb, and log_target::tgt_rb.