libosmocore  0.9.6.315-40e62
Osmocom core library
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Osmocom logging framework

Files

file  logging.h
 
file  logging_gsmtap.c
 libosmocore log output encapsulated in GSMTAP.
 
file  logging_syslog.c
 Syslog logging support code.
 
file  loggingrb.c
 Ringbuffer-backed logging support code.
 

Data Structures

struct  log_category
 Configuration of single log category / sub-system. More...
 
struct  log_info_cat
 Information regarding one logging category. More...
 
struct  log_context
 Log context information, passed to filter. More...
 
struct  log_info
 Logging configuration, passed to log_init. More...
 
struct  log_target
 structure representing a logging target More...
 

Macros

#define LOG_MAX_CTX   8
 Maximum number of logging contexts. More...
 
#define LOG_MAX_FILTERS   8
 Maximum number of logging filters. More...
 
#define DEBUG
 
#define DEBUGP(ss, fmt, args...)   LOGP(ss, LOGL_DEBUG, fmt, ##args)
 Log a debug message through the Osmocom logging framework. More...
 
#define DEBUGPC(ss, fmt, args...)   LOGPC(ss, LOGL_DEBUG, fmt, ##args)
 
#define LOGP(ss, level, fmt, args...)   LOGPSRC(ss, level, NULL, 0, fmt, ## args)
 Log a new message through the Osmocom logging framework. More...
 
#define LOGPC(ss, level, fmt, args...)
 Continue a log message through the Osmocom logging framework. More...
 
#define LOGPSRC(ss, level, caller_file, caller_line, fmt, args...)
 Log through the Osmocom logging framework with explicit source. More...
 
#define LOGL_DEBUG   1
 different log levels More...
 
#define LOGL_INFO   3
 general information More...
 
#define LOGL_NOTICE   5
 abnormal/unexpected condition More...
 
#define LOGL_ERROR   7
 error condition, requires user action More...
 
#define LOGL_FATAL   8
 fatal, program aborted More...
 
#define DLGLOBAL   -1
 global logging More...
 
#define DLLAPD   -2
 LAPD implementation. More...
 
#define DLINP   -3
 (A-bis) Input sub-system More...
 
#define DLMUX   -4
 Osmocom Multiplex (Osmux) More...
 
#define DLMI   -5
 ISDN-layer below input sub-system. More...
 
#define DLMIB   -6
 ISDN layer B-channel. More...
 
#define DLSMS   -7
 SMS sub-system. More...
 
#define DLCTRL   -8
 Control Interface. More...
 
#define DLGTP   -9
 GTP (GPRS Tunneling Protocol. More...
 
#define DLSTATS   -10
 Statistics. More...
 
#define DLGSUP   -11
 Generic Subscriber Update Protocol. More...
 
#define DLOAP   -12
 Osmocom Authentication Protocol. More...
 
#define DLSS7   -13
 Osmocom SS7. More...
 
#define DLSCCP   -14
 Osmocom SCCP. More...
 
#define DLSUA   -15
 Osmocom SUA. More...
 
#define DLM3UA   -16
 Osmocom M3UA. More...
 
#define OSMO_NUM_DLIB   16
 Number of logging sub-systems in libraries. More...
 
#define LOG_FILTER_ALL   (1<<LOG_FLT_ALL)
 Compatibility with older libosmocore versions. More...
 
#define GPRS_CTX_NSVC   LOG_CTX_GB_NSVC
 Compatibility with older libosmocore versions. More...
 
#define GPRS_CTX_BVC   LOG_CTX_GB_BVC
 Compatibility with older libosmocore versions. More...
 
#define GSMTAP_LOG_MAX_SIZE   4096
 

Typedefs

typedef int log_filter (const struct log_context *ctx, struct log_target *target)
 Log filter function. More...
 
typedef void log_print_filters (struct vty *vty, const struct log_info *info, const struct log_target *tgt)
 
typedef void log_save_filters (struct vty *vty, const struct log_info *info, const struct log_target *tgt)
 

Enumerations

enum  log_ctx_index {
  LOG_CTX_GB_NSVC,
  LOG_CTX_GB_BVC,
  LOG_CTX_BSC_SUBSCR,
  LOG_CTX_VLR_SUBSCR,
  _LOG_CTX_COUNT
}
 Indexes to indicate the object currently acted upon. More...
 
enum  log_filter_index {
  LOG_FLT_ALL,
  LOG_FLT_GB_NSVC,
  LOG_FLT_GB_BVC,
  LOG_FLT_BSC_SUBSCR,
  LOG_FLT_VLR_SUBSCR,
  _LOG_FLT_COUNT
}
 Indexes to indicate objects that should be logged. More...
 
enum  log_target_type {
  LOG_TGT_TYPE_VTY,
  LOG_TGT_TYPE_SYSLOG,
  LOG_TGT_TYPE_FILE,
  LOG_TGT_TYPE_STDERR,
  LOG_TGT_TYPE_STRRB,
  LOG_TGT_TYPE_GSMTAP
}
 Type of logging target. More...
 

Functions

void osmo_vlogp (int subsys, int level, const char *file, int line, int cont, const char *format, va_list ap)
 vararg version of logging function More...
 
void logp (int subsys, const char *file, int line, int cont, const char *format,...) OSMO_DEPRECATED("Use DEBUGP* macros instead")
 logging function used by DEBUGP() macro More...
 
void logp2 (int subsys, unsigned int level, const char *file, int line, int cont, const char *format,...) __attribute__((format(printf
 
void int log_init (const struct log_info *inf, void *talloc_ctx)
 Initialize the Osmocom logging core. More...
 
void log_fini (void)
 
int log_check_level (int subsys, unsigned int level)
 Check whether a log entry will be generated. More...
 
void log_reset_context (void)
 Reset (clear) the logging context. More...
 
int log_set_context (uint8_t ctx, void *value)
 Set the logging context. More...
 
void log_set_all_filter (struct log_target *target, int)
 Enable the LOG_FLT_ALL log filter. More...
 
void log_set_use_color (struct log_target *target, int)
 Enable or disable the use of colored output. More...
 
void log_set_print_extended_timestamp (struct log_target *target, int)
 Enable or disable printing of extended timestamps while logging. More...
 
void log_set_print_timestamp (struct log_target *target, int)
 Enable or disable printing of timestamps while logging. More...
 
void log_set_print_filename (struct log_target *target, int)
 Enable or disable printing of the filename while logging. More...
 
void log_set_print_category (struct log_target *target, int)
 Enable or disable printing of the category name. More...
 
void log_set_log_level (struct log_target *target, int log_level)
 Set the global log level for a given log target. More...
 
void log_parse_category_mask (struct log_target *target, const char *mask)
 parse the log category mask More...
 
const char * log_category_name (int subsys)
 
int log_parse_level (const char *lvl)
 Parse a human-readable log level into a numeric value. More...
 
const char * log_level_str (unsigned int lvl)
 convert a numeric log level into human-readable string More...
 
int log_parse_category (const char *category)
 parse a human-readable log category into numeric form More...
 
void log_set_category_filter (struct log_target *target, int category, int enable, int level)
 Set a category filter on a given log target. More...
 
struct log_targetlog_target_create (void)
 Create a new log target skeleton. More...
 
void log_target_destroy (struct log_target *target)
 Unregister, close and delete a log target. More...
 
struct log_targetlog_target_create_stderr (void)
 Create the STDERR log target. More...
 
struct log_targetlog_target_create_file (const char *fname)
 Create a new file-based log target. More...
 
struct log_targetlog_target_create_syslog (const char *ident, int option, int facility)
 
struct log_targetlog_target_create_gsmtap (const char *host, uint16_t port, const char *ident, bool ofd_wq_mode, bool add_sink)
 Create a new logging target for GSMTAP logging. More...
 
int log_target_file_reopen (struct log_target *tgt)
 close and re-open a log file (for log file rotation) More...
 
int log_targets_reopen (void)
 close and re-open all log files (for log file rotation) More...
 
void log_add_target (struct log_target *target)
 Register a new log target with the logging core. More...
 
void log_del_target (struct log_target *target)
 Unregister a log target from the logging core. More...
 
const char * log_vty_command_string () OSMO_DEPRECATED_OUTSIDE_LIBOSMOCORE
 Generates the logging command string for VTY. More...
 
const char * log_vty_command_description () OSMO_DEPRECATED_OUTSIDE_LIBOSMOCORE
 Generates the logging command description for VTY. More...
 
struct log_targetlog_target_find (int type, const char *fname)
 Find a registered log target. More...
 
static void _gsmtap_raw_output (struct log_target *target, int subsys, unsigned int level, const char *file, int line, int cont, const char *format, va_list ap)
 
static void _rb_output (struct log_target *target, unsigned int level, const char *log)
 
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_targetlog_target_create_rb (size_t size)
 Create a new logging target for ringbuffer-backed logging. More...
 

Variables

struct llist_head osmo_log_target_list
 

Detailed Description

Macro Definition Documentation

#define DEBUG
#define DEBUGP (   ss,
  fmt,
  args... 
)    LOGP(ss, LOGL_DEBUG, fmt, ##args)

Log a debug message through the Osmocom logging framework.

Parameters
[in]sslogging subsystem (e.g. DLGLOBAL)
[in]fmtformat string
[in]argsvariable argument list
#define DEBUGPC (   ss,
  fmt,
  args... 
)    LOGPC(ss, LOGL_DEBUG, fmt, ##args)
#define DLCTRL   -8

Control Interface.

#define DLGLOBAL   -1

global logging

Referenced by _osmo_fsm_inst_dispatch(), map_subsys(), and osmo_wqueue_enqueue().

#define DLGSUP   -11

Generic Subscriber Update Protocol.

#define DLGTP   -9

GTP (GPRS Tunneling Protocol.

#define DLINP   -3

(A-bis) Input sub-system

#define DLLAPD   -2

LAPD implementation.

#define DLM3UA   -16

Osmocom M3UA.

#define DLMI   -5

ISDN-layer below input sub-system.

#define DLMIB   -6

ISDN layer B-channel.

#define DLMUX   -4

Osmocom Multiplex (Osmux)

#define DLOAP   -12

Osmocom Authentication Protocol.

#define DLSCCP   -14

Osmocom SCCP.

#define DLSMS   -7

SMS sub-system.

#define DLSS7   -13

Osmocom SS7.

#define DLSTATS   -10

Statistics.

Referenced by osmo_stats_reporter_log_send().

#define DLSUA   -15

Osmocom SUA.

#define GPRS_CTX_BVC   LOG_CTX_GB_BVC

Compatibility with older libosmocore versions.

#define GPRS_CTX_NSVC   LOG_CTX_GB_NSVC

Compatibility with older libosmocore versions.

#define GSMTAP_LOG_MAX_SIZE   4096

Referenced by _gsmtap_raw_output().

#define LOG_FILTER_ALL   (1<<LOG_FLT_ALL)

Compatibility with older libosmocore versions.

#define LOG_MAX_CTX   8

Maximum number of logging contexts.

Referenced by log_set_context().

#define LOG_MAX_FILTERS   8

Maximum number of logging filters.

#define LOGL_DEBUG   1

different log levels

debugging information

Referenced by logp().

#define LOGL_ERROR   7
#define LOGL_FATAL   8

fatal, program aborted

#define LOGL_INFO   3

general information

Referenced by osmo_stats_reporter_log_send().

#define LOGL_NOTICE   5

abnormal/unexpected condition

#define LOGP (   ss,
  level,
  fmt,
  args... 
)    LOGPSRC(ss, level, NULL, 0, fmt, ## args)

Log a new message through the Osmocom logging framework.

Parameters
[in]sslogging subsystem (e.g. DLGLOBAL)
[in]levellogging level (e.g. LOGL_NOTICE)
[in]fmtformat string
[in]argsvariable argument list

Referenced by _osmo_backtrace(), osmo_stats_reporter_log_send(), and osmo_wqueue_enqueue().

#define LOGPC (   ss,
  level,
  fmt,
  args... 
)
Value:
do { \
logp2(ss, level, __BASE_FILE__, __LINE__, 1, fmt, ##args); \
} while(0)
uint8_t level
logging level
Definition: gsmtap.h:117
void logp2(int subsys, unsigned int level, const char *file, int line, int cont, const char *format,...) __attribute__((format(printf
int log_check_level(int subsys, unsigned int level)
Check whether a log entry will be generated.
Definition: logging.c:1020

Continue a log message through the Osmocom logging framework.

Parameters
[in]sslogging subsystem (e.g. DLGLOBAL)
[in]levellogging level (e.g. LOGL_NOTICE)
[in]fmtformat string
[in]argsvariable argument list
#define LOGPSRC (   ss,
  level,
  caller_file,
  caller_line,
  fmt,
  args... 
)
Value:
do { \
if (log_check_level(ss, level)) {\
if (caller_file) \
logp2(ss, level, caller_file, caller_line, 0, fmt, ##args); \
logp2(ss, level, __BASE_FILE__, __LINE__, 0, fmt, ##args); \
}\
} while(0)
uint8_t level
logging level
Definition: gsmtap.h:117
void logp2(int subsys, unsigned int level, const char *file, int line, int cont, const char *format,...) __attribute__((format(printf
int log_check_level(int subsys, unsigned int level)
Check whether a log entry will be generated.
Definition: logging.c:1020

Log through the Osmocom logging framework with explicit source.

If caller_file is passed as NULL, BASE_FILE and LINE are used instead of caller_file and caller_line (so that this macro here defines both cases in the same place, and to catch cases where callers fail to pass a non-null filename string).

Parameters
[in]sslogging subsystem (e.g. DLGLOBAL)
[in]levellogging level (e.g. LOGL_NOTICE)
[in]caller_filecaller's source file string (e.g. BASE_FILE)
[in]caller_linecaller's source line nr (e.g. LINE)
[in]fmtformat string
[in]argsvariable argument list

Referenced by _osmo_fsm_inst_dispatch().

#define OSMO_NUM_DLIB   16

Number of logging sub-systems in libraries.

Typedef Documentation

typedef int log_filter(const struct log_context *ctx, struct log_target *target)

Log filter function.

typedef void log_print_filters(struct vty *vty, const struct log_info *info, const struct log_target *tgt)
typedef void log_save_filters(struct vty *vty, const struct log_info *info, const struct log_target *tgt)

Enumeration Type Documentation

Indexes to indicate the object currently acted upon.

Array indexes for the global log_context array.

Enumerator
LOG_CTX_GB_NSVC 
LOG_CTX_GB_BVC 
LOG_CTX_BSC_SUBSCR 
LOG_CTX_VLR_SUBSCR 
_LOG_CTX_COUNT 

Indexes to indicate objects that should be logged.

Array indexes to log_target->filter_data and bit indexes for log_target->filter_map.

Enumerator
LOG_FLT_ALL 
LOG_FLT_GB_NSVC 
LOG_FLT_GB_BVC 
LOG_FLT_BSC_SUBSCR 
LOG_FLT_VLR_SUBSCR 
_LOG_FLT_COUNT 

Type of logging target.

Enumerator
LOG_TGT_TYPE_VTY 

VTY logging.

LOG_TGT_TYPE_SYSLOG 

syslog based logging

LOG_TGT_TYPE_FILE 

text file logging

LOG_TGT_TYPE_STDERR 

stderr logging

LOG_TGT_TYPE_STRRB 

osmo_strrb-backed logging

LOG_TGT_TYPE_GSMTAP 

GSMTAP network logging.

Function Documentation

static void _rb_output ( struct log_target target,
unsigned int  level,
const char *  log 
)
static
void log_add_target ( struct log_target target)

Register a new log target with the logging core.

Parameters
[in]targetLog target to be registered

References log_target::entry, llist_add_tail(), and osmo_log_target_list.

Referenced by osmo_init_logging().

const char* log_category_name ( int  subsys)

References log_info::cat, log_info_cat::name, and subsys.

Referenced by _gsmtap_raw_output(), and _output().

int log_check_level ( int  subsys,
unsigned int  level 
)

Check whether a log entry will be generated.

Returns
!= 0 if a log entry might get generated by at least one target

References assert_loginfo(), log_target::entry, llist_for_each_entry, map_subsys(), osmo_log_target_list, and should_log_to_target().

void log_del_target ( struct log_target target)

Unregister a log target from the logging core.

Parameters
[in]targetLog target to be unregistered

References log_target::entry, and llist_del().

Referenced by log_target_destroy().

void int log_init ( const struct log_info inf,
void *  ctx 
)

Initialize the Osmocom logging core.

Parameters
[in]infInformation regarding logging categories
[in]ctxtalloc context for logging allocations
Returns
0 in case of success, negative in case of error

References ARRAY_SIZE, log_info::cat, log_info::filter_fn, log_info::num_cat, and log_info::num_cat_user.

Referenced by osmo_init_logging().

const char* log_level_str ( unsigned int  lvl)

convert a numeric log level into human-readable string

Parameters
lvl[in]numeric log level
Returns
zero-terminated string (log level name)

References get_value_string().

int log_parse_category ( const char *  category)

parse a human-readable log category into numeric form

Parameters
[in]categoryhuman-readable log category name
Returns
numeric category value, or -EINVAL otherwise

References assert_loginfo(), log_info::cat, log_info_cat::name, and log_info::num_cat.

void log_parse_category_mask ( struct log_target target,
const char *  _mask 
)

parse the log category mask

Parameters
[in]targetlog target to be configured
[in]_masklog category mask string

The format can be this: category1:category2:category3 or category1,2:category2,3:...

References assert_loginfo(), log_info::cat, log_target::categories, log_category::enabled, level, log_category::loglevel, log_info_cat::name, log_info::num_cat, and OSMO_ASSERT.

int log_parse_level ( const char *  lvl)

Parse a human-readable log level into a numeric value.

Parameters
lvl[in]zero-terminated string containing log level name
Returns
numeric log level

References get_string_value().

void log_reset_context ( void  )

Reset (clear) the logging context.

void log_set_all_filter ( struct log_target target,
int  all 
)

Enable the LOG_FLT_ALL log filter.

Parameters
[in]targetLog target to be affected
[in]allenable (1) or disable (0) the ALL filter

When the LOG_FLT_ALL filter is enabled, all log messages will be printed. It acts as a wildcard. Setting it to 1 means there is no filtering.

References log_target::filter_map, and LOG_FLT_ALL.

Referenced by osmo_init_logging().

void log_set_category_filter ( struct log_target target,
int  category,
int  enable,
int  level 
)

Set a category filter on a given log target.

Parameters
[in]targetLog target to be affected
[in]categoryLog category to be affected
[in]enablewhether to enable or disable the filter
[in]levelLog level of the filter

References log_target::categories, log_category::enabled, level, log_category::loglevel, and map_subsys().

int log_set_context ( uint8_t  ctx_nr,
void *  value 
)

Set the logging context.

Parameters
[in]ctx_nrlogging context number
[in]valuevalue to which the context is to be set
Returns
0 in case of success; negative otherwise

A logging context is something like the subscriber identity to which the currently processed message relates, or the BTS through which it was received. As soon as this data is known, it can be set using this function. The main use of context information is for logging filters.

References log_context::ctx, and LOG_MAX_CTX.

void log_set_log_level ( struct log_target target,
int  log_level 
)

Set the global log level for a given log target.

Parameters
[in]targetLog target to be affected
[in]log_levelNew global log level

References log_target::loglevel.

void log_set_print_category ( struct log_target target,
int  print_category 
)

Enable or disable printing of the category name.

Parameters
[in]targetLog target to be affected
[in]print_catnameEnable (1) or disable (0) filenames

Print the category/subsys name in front of every log message.

References log_target::print_category.

void log_set_print_extended_timestamp ( struct log_target target,
int  print_timestamp 
)

Enable or disable printing of extended timestamps while logging.

Parameters
[in]targetLog target to be affected
[in]print_timestampEnable (1) or disable (0) timestamps

When both timestamp and extended timestamp is enabled then only the extended timestamp will be used. The format of the timestamp is YYYYMMDDhhmmssnnn.

References log_target::print_ext_timestamp, and log_target::print_timestamp.

void log_set_print_filename ( struct log_target target,
int  print_filename 
)

Enable or disable printing of the filename while logging.

Parameters
[in]targetLog target to be affected
[in]print_filenameEnable (1) or disable (0) filenames

References log_target::print_filename.

void log_set_print_timestamp ( struct log_target target,
int  print_timestamp 
)

Enable or disable printing of timestamps while logging.

Parameters
[in]targetLog target to be affected
[in]print_timestampEnable (1) or disable (0) timestamps

References log_target::print_timestamp.

void log_set_use_color ( struct log_target target,
int  use_color 
)

Enable or disable the use of colored output.

Parameters
[in]targetLog target to be affected
[in]use_colorUse color (1) or don't use color (0)

References log_target::use_color.

struct log_target* log_target_create ( void  )

Create a new log target skeleton.

Returns
dynamically-allocated log target This funcition allocates a log_target and initializes it with some default values. The newly created target is not registered yet.

References assert_loginfo(), log_info::cat, log_target::categories, log_category::enabled, log_info_cat::enabled, log_target::entry, INIT_LLIST_HEAD, log_category::loglevel, log_info_cat::loglevel, log_target::loglevel, log_info::num_cat, log_target::print_filename, log_target::print_timestamp, and log_target::use_color.

Referenced by log_target_create_file(), log_target_create_gsmtap(), log_target_create_rb(), and log_target_create_stderr().

struct log_target* log_target_create_file ( const char *  fname)

Create a new file-based log target.

Parameters
[in]fnameFile name of the new log file
Returns
Log target in case of success, NULL otherwise

References _file_output(), log_target_create(), LOG_TGT_TYPE_FILE, log_target::output, log_target::tgt_file, and log_target::type.

struct log_target * log_target_create_gsmtap ( const char *  host,
uint16_t  port,
const char *  ident,
bool  ofd_wq_mode,
bool  add_sink 
)

Create a new logging target for GSMTAP logging.

Parameters
[in]identstring identifier
Returns
Log target in case of success, NULL in case of error

References _gsmtap_raw_output(), gsmtap_source_add_sink(), gsmtap_source_init(), log_target_create(), log_target_destroy(), LOG_TGT_TYPE_GSMTAP, log_target::raw_output, log_target::tgt_gsmtap, and log_target::type.

struct log_target* log_target_create_rb ( size_t  size)

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 _rb_output(), log_target_create(), log_target_destroy(), LOG_TGT_TYPE_STRRB, osmo_strrb_create(), log_target::output, log_target::tgt_rb, and log_target::type.

struct log_target* log_target_create_stderr ( void  )

Create the STDERR log target.

Returns
dynamically-allocated log_target for STDERR

References _file_output(), log_target_create(), LOG_TGT_TYPE_STDERR, log_target::output, log_target::tgt_file, and log_target::type.

Referenced by osmo_init_logging().

struct log_target* log_target_create_syslog ( const char *  ident,
int  option,
int  facility 
)
void log_target_destroy ( struct log_target target)

Unregister, close and delete a log target.

Parameters
target[in]log target to unregister, close and delete

References _file_output(), log_del_target(), log_target::output, and log_target::tgt_file.

Referenced by log_fini(), log_target_create_gsmtap(), and log_target_create_rb().

int log_target_file_reopen ( struct log_target target)

close and re-open a log file (for log file rotation)

Parameters
[in]targetlog target to re-open
Returns
0 in case of success; negative otherwise

References log_target::tgt_file.

Referenced by log_targets_reopen().

struct log_target* log_target_find ( int  type,
const char *  fname 
)

Find a registered log target.

Parameters
[in]typeLog target type
[in]fnameFile name
Returns
Log target (if found), NULL otherwise

References log_target::entry, llist_for_each_entry, LOG_TGT_TYPE_FILE, osmo_log_target_list, log_target::tgt_file, 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, 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.

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(), 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.

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

References osmo_strrb_elements(), and log_target::tgt_rb.

int log_targets_reopen ( void  )

close and re-open all log files (for log file rotation)

Returns
0 in case of success; negative otherwise

References log_target::entry, llist_for_each_entry, log_target_file_reopen(), LOG_TGT_TYPE_FILE, osmo_log_target_list, and log_target::type.

Referenced by sighup_hdlr().

const char* log_vty_command_description ( )

Generates the logging command description for VTY.

Parameters
[in]unused_infoDeprecated parameter, no longer used!
Returns
logging command description for use by VTY command node

References assert_loginfo(), log_info::cat, log_info_cat::description, LOGLEVEL_DEFS, log_info_cat::name, log_info::num_cat, osmo_log_info, and OSMO_SNPRINTF_RET.

const char* log_vty_command_string ( )

Generates the logging command string for VTY.

Parameters
[in]unused_infoDeprecated parameter, no longer used!
Returns
vty command string for use by VTY command node

References assert_loginfo(), log_info::cat, LOGLEVEL_DEFS, log_info_cat::name, name, log_info::num_cat, osmo_log_info, and OSMO_SNPRINTF_RET.

void logp ( int  subsys,
const char *  file,
int  line,
int  cont,
const char *  format,
  ... 
)

logging function used by DEBUGP() macro

Parameters
[in]subsysLogging sub-system
[in]filename of source code file
[in]contcontinuation (1) or new line (0)
[in]formatformat string

References LOGL_DEBUG, and osmo_vlogp().

void logp2 ( int  subsys,
unsigned int  level,
const char *  file,
int  line,
int  cont,
const char *  format,
  ... 
)
void osmo_vlogp ( int  subsys,
int  level,
const char *  file,
int  line,
int  cont,
const char *  format,
va_list  ap 
)

vararg version of logging function

Parameters
[in]subsysLogging sub-system
[in]levelLog level
[in]filename of source code file
[in]contcontinuation (1) or new line (0)
[in]formatformat string
[in]apvararg-list containing format string arguments

References _output(), log_target::entry, llist_for_each_entry, map_subsys(), osmo_log_target_list, log_target::raw_output, and should_log_to_target().

Referenced by logp(), and logp2().

Variable Documentation