2014-06-16 08:13:40 +00:00
|
|
|
#pragma once
|
2010-03-26 13:24:24 +00:00
|
|
|
|
2011-08-17 12:14:17 +00:00
|
|
|
/*! \defgroup logging Osmocom logging framework
|
|
|
|
* @{
|
2011-08-16 21:26:52 +00:00
|
|
|
*/
|
|
|
|
|
2011-08-17 12:14:17 +00:00
|
|
|
/*! \file logging.h */
|
|
|
|
|
2010-03-26 13:24:24 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdint.h>
|
2011-09-01 14:22:17 +00:00
|
|
|
#include <stdarg.h>
|
2016-12-02 14:30:02 +00:00
|
|
|
#include <stdbool.h>
|
2017-01-13 10:01:12 +00:00
|
|
|
#include <osmocom/core/defs.h>
|
2011-03-22 15:36:13 +00:00
|
|
|
#include <osmocom/core/linuxlist.h>
|
2010-03-26 13:24:24 +00:00
|
|
|
|
2017-06-19 22:17:59 +00:00
|
|
|
/*! Maximum number of logging contexts */
|
2010-03-26 13:24:24 +00:00
|
|
|
#define LOG_MAX_CTX 8
|
2017-06-19 22:17:59 +00:00
|
|
|
/*! Maximum number of logging filters */
|
2010-03-26 13:24:24 +00:00
|
|
|
#define LOG_MAX_FILTERS 8
|
|
|
|
|
|
|
|
#define DEBUG
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
2017-06-19 22:17:59 +00:00
|
|
|
/*! Log a debug message through the Osmocom logging framework
|
2016-04-25 10:11:20 +00:00
|
|
|
* \param[in] ss logging subsystem (e.g. \ref DLGLOBAL)
|
|
|
|
* \param[in] fmt format string
|
|
|
|
* \param[in] args variable argument list
|
|
|
|
*/
|
2017-01-13 10:01:12 +00:00
|
|
|
#define DEBUGP(ss, fmt, args...) LOGP(ss, LOGL_DEBUG, fmt, ##args)
|
|
|
|
#define DEBUGPC(ss, fmt, args...) LOGPC(ss, LOGL_DEBUG, fmt, ##args)
|
2010-03-26 13:24:24 +00:00
|
|
|
#else
|
|
|
|
#define DEBUGP(xss, fmt, args...)
|
|
|
|
#define DEBUGPC(ss, fmt, args...)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2012-07-12 07:26:25 +00:00
|
|
|
void osmo_vlogp(int subsys, int level, const char *file, int line,
|
2011-08-27 12:33:19 +00:00
|
|
|
int cont, const char *format, va_list ap);
|
|
|
|
|
2017-01-13 10:01:12 +00:00
|
|
|
void logp(int subsys, const char *file, int line, int cont, const char *format, ...) OSMO_DEPRECATED("Use DEBUGP* macros instead");
|
2010-03-26 13:24:24 +00:00
|
|
|
|
2017-06-19 22:17:59 +00:00
|
|
|
/*! Log a new message through the Osmocom logging framework
|
2011-08-16 21:26:52 +00:00
|
|
|
* \param[in] ss logging subsystem (e.g. \ref DLGLOBAL)
|
|
|
|
* \param[in] level logging level (e.g. \ref LOGL_NOTICE)
|
|
|
|
* \param[in] fmt format string
|
|
|
|
* \param[in] args variable argument list
|
|
|
|
*/
|
2010-03-26 13:24:24 +00:00
|
|
|
#define LOGP(ss, level, fmt, args...) \
|
fsm: log caller's source for events and state changes, not fsm.c lines
When looking at log output, it is not interesting to see that a state
transition's petty details are implemented in fsm.c. Rather log the *caller's*
source file and line that caused an event, state change and cascading events.
To that end, introduce LOGPSRC() absorbing the guts of LOGP(), to be able to
explicitly pass the source file and line information.
Prepend an underscore to the function names of osmo_fsm_inst_state_chg(),
osmo_fsm_inst_dispatch() and osmo_fsm_inst_term(), and add file and line
arguments to them. Provide the previous names as macros that insert the
caller's __BASE_FILE__ and __LINE__ constants for the new arguments. Hence no
calling code needs to be changed.
In fsm.c, add LOGPFSMSRC to call LOGPSRC, and add LOGPFSMLSRC, and use them in
above _osmo_fsm_inst_* functions.
In addition, in _osmo_fsm_inst_term(), pass the caller's source file and line
on to nested event dispatches, so showing where a cascade originated from.
Change-Id: Iae72aba7bbf99e19dd584ccabea5867210650dcd
2016-12-14 16:24:54 +00:00
|
|
|
LOGPSRC(ss, level, NULL, 0, fmt, ## args)
|
2011-08-16 21:26:52 +00:00
|
|
|
|
2017-06-19 22:17:59 +00:00
|
|
|
/*! Continue a log message through the Osmocom logging framework
|
2011-08-16 21:26:52 +00:00
|
|
|
* \param[in] ss logging subsystem (e.g. \ref DLGLOBAL)
|
|
|
|
* \param[in] level logging level (e.g. \ref LOGL_NOTICE)
|
|
|
|
* \param[in] fmt format string
|
|
|
|
* \param[in] args variable argument list
|
|
|
|
*/
|
2010-03-26 13:24:24 +00:00
|
|
|
#define LOGPC(ss, level, fmt, args...) \
|
2015-11-17 10:52:25 +00:00
|
|
|
do { \
|
|
|
|
if (log_check_level(ss, level)) \
|
2016-05-10 13:23:06 +00:00
|
|
|
logp2(ss, level, __BASE_FILE__, __LINE__, 1, fmt, ##args); \
|
2015-11-17 10:52:25 +00:00
|
|
|
} while(0)
|
2010-03-26 13:24:24 +00:00
|
|
|
|
2017-06-19 22:17:59 +00:00
|
|
|
/*! Log through the Osmocom logging framework with explicit source.
|
fsm: log caller's source for events and state changes, not fsm.c lines
When looking at log output, it is not interesting to see that a state
transition's petty details are implemented in fsm.c. Rather log the *caller's*
source file and line that caused an event, state change and cascading events.
To that end, introduce LOGPSRC() absorbing the guts of LOGP(), to be able to
explicitly pass the source file and line information.
Prepend an underscore to the function names of osmo_fsm_inst_state_chg(),
osmo_fsm_inst_dispatch() and osmo_fsm_inst_term(), and add file and line
arguments to them. Provide the previous names as macros that insert the
caller's __BASE_FILE__ and __LINE__ constants for the new arguments. Hence no
calling code needs to be changed.
In fsm.c, add LOGPFSMSRC to call LOGPSRC, and add LOGPFSMLSRC, and use them in
above _osmo_fsm_inst_* functions.
In addition, in _osmo_fsm_inst_term(), pass the caller's source file and line
on to nested event dispatches, so showing where a cascade originated from.
Change-Id: Iae72aba7bbf99e19dd584ccabea5867210650dcd
2016-12-14 16:24:54 +00:00
|
|
|
* 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).
|
|
|
|
* \param[in] ss logging subsystem (e.g. \ref DLGLOBAL)
|
|
|
|
* \param[in] level logging level (e.g. \ref LOGL_NOTICE)
|
|
|
|
* \param[in] caller_file caller's source file string (e.g. __BASE_FILE__)
|
|
|
|
* \param[in] caller_line caller's source line nr (e.g. __LINE__)
|
|
|
|
* \param[in] fmt format string
|
|
|
|
* \param[in] args variable argument list
|
|
|
|
*/
|
|
|
|
#define LOGPSRC(ss, level, caller_file, caller_line, fmt, args...) \
|
|
|
|
do { \
|
|
|
|
if (log_check_level(ss, level)) {\
|
|
|
|
if (caller_file) \
|
|
|
|
logp2(ss, level, caller_file, caller_line, 0, fmt, ##args); \
|
|
|
|
else \
|
|
|
|
logp2(ss, level, __BASE_FILE__, __LINE__, 0, fmt, ##args); \
|
|
|
|
}\
|
|
|
|
} while(0)
|
|
|
|
|
2017-06-19 22:17:59 +00:00
|
|
|
/*! different log levels */
|
|
|
|
#define LOGL_DEBUG 1 /*!< debugging information */
|
|
|
|
#define LOGL_INFO 3 /*!< general information */
|
|
|
|
#define LOGL_NOTICE 5 /*!< abnormal/unexpected condition */
|
|
|
|
#define LOGL_ERROR 7 /*!< error condition, requires user action */
|
|
|
|
#define LOGL_FATAL 8 /*!< fatal, program aborted */
|
2010-03-26 13:24:24 +00:00
|
|
|
|
2011-06-27 08:29:17 +00:00
|
|
|
/* logging levels defined by the library itself */
|
2016-04-25 10:11:20 +00:00
|
|
|
#define DLGLOBAL -1 /*!< global logging */
|
|
|
|
#define DLLAPD -2 /*!< LAPD implementation */
|
|
|
|
#define DLINP -3 /*!< (A-bis) Input sub-system */
|
|
|
|
#define DLMUX -4 /*!< Osmocom Multiplex (Osmux) */
|
|
|
|
#define DLMI -5 /*!< ISDN-layer below input sub-system */
|
|
|
|
#define DLMIB -6 /*!< ISDN layer B-channel */
|
|
|
|
#define DLSMS -7 /*!< SMS sub-system */
|
|
|
|
#define DLCTRL -8 /*!< Control Interface */
|
|
|
|
#define DLGTP -9 /*!< GTP (GPRS Tunneling Protocol */
|
|
|
|
#define DLSTATS -10 /*!< Statistics */
|
2016-12-10 16:01:06 +00:00
|
|
|
#define DLGSUP -11 /*!< Generic Subscriber Update Protocol */
|
2016-04-27 16:32:35 +00:00
|
|
|
#define DLOAP -12 /*!< Osmocom Authentication Protocol */
|
2017-04-03 17:37:11 +00:00
|
|
|
#define DLSS7 -13 /*!< Osmocom SS7 */
|
|
|
|
#define DLSCCP -14 /*!< Osmocom SCCP */
|
|
|
|
#define DLSUA -15 /*!< Osmocom SUA */
|
|
|
|
#define DLM3UA -16 /*!< Osmocom M3UA */
|
|
|
|
#define OSMO_NUM_DLIB 16 /*!< Number of logging sub-systems in libraries */
|
2016-04-25 10:11:20 +00:00
|
|
|
|
|
|
|
/*! Configuration of singgle log category / sub-system */
|
2010-03-26 13:24:24 +00:00
|
|
|
struct log_category {
|
2016-04-25 10:11:20 +00:00
|
|
|
uint8_t loglevel; /*!< configured log-level */
|
|
|
|
uint8_t enabled; /*!< is logging enabled? */
|
2010-03-26 13:24:24 +00:00
|
|
|
};
|
|
|
|
|
2017-06-19 22:17:59 +00:00
|
|
|
/*! Information regarding one logging category */
|
2010-03-26 13:24:24 +00:00
|
|
|
struct log_info_cat {
|
2011-08-17 12:14:17 +00:00
|
|
|
const char *name; /*!< name of category */
|
|
|
|
const char *color; /*!< color string for cateyory */
|
|
|
|
const char *description; /*!< description text */
|
|
|
|
uint8_t loglevel; /*!< currently selected log-level */
|
|
|
|
uint8_t enabled; /*!< is this category enabled or not */
|
2010-03-26 13:24:24 +00:00
|
|
|
};
|
|
|
|
|
2017-06-19 22:17:59 +00:00
|
|
|
/*! Log context information, passed to filter */
|
2010-03-26 13:24:24 +00:00
|
|
|
struct log_context {
|
|
|
|
void *ctx[LOG_MAX_CTX+1];
|
|
|
|
};
|
|
|
|
|
2017-06-19 22:17:59 +00:00
|
|
|
/*! Indexes to indicate the object currently acted upon.
|
2017-02-23 16:45:26 +00:00
|
|
|
* Array indexes for the global \a log_context array. */
|
2017-02-23 17:03:28 +00:00
|
|
|
enum log_ctx_index {
|
|
|
|
LOG_CTX_GB_NSVC,
|
|
|
|
LOG_CTX_GB_BVC,
|
|
|
|
LOG_CTX_BSC_SUBSCR,
|
|
|
|
LOG_CTX_VLR_SUBSCR,
|
|
|
|
_LOG_CTX_COUNT
|
2017-02-17 15:35:27 +00:00
|
|
|
};
|
|
|
|
|
2017-06-19 22:17:59 +00:00
|
|
|
/*! Indexes to indicate objects that should be logged.
|
2017-02-23 16:45:26 +00:00
|
|
|
* Array indexes to log_target->filter_data and bit indexes for
|
|
|
|
* log_target->filter_map. */
|
2017-02-23 17:03:28 +00:00
|
|
|
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
|
2017-02-17 15:35:27 +00:00
|
|
|
};
|
|
|
|
|
2017-06-19 22:17:59 +00:00
|
|
|
/*! Compatibility with older libosmocore versions */
|
2017-02-23 17:03:28 +00:00
|
|
|
#define LOG_FILTER_ALL (1<<LOG_FLT_ALL)
|
2017-06-19 22:17:59 +00:00
|
|
|
/*! Compatibility with older libosmocore versions */
|
2017-02-23 17:03:28 +00:00
|
|
|
#define GPRS_CTX_NSVC LOG_CTX_GB_NSVC
|
2017-06-19 22:17:59 +00:00
|
|
|
/*! Compatibility with older libosmocore versions */
|
2017-02-23 17:03:28 +00:00
|
|
|
#define GPRS_CTX_BVC LOG_CTX_GB_BVC
|
2017-06-19 22:17:59 +00:00
|
|
|
/*! Indexes to indicate the object currently acted upon.
|
2017-02-23 17:03:28 +00:00
|
|
|
* Array indexes for the global \a log_context array. */
|
2017-02-23 16:34:35 +00:00
|
|
|
|
2010-03-26 13:24:24 +00:00
|
|
|
struct log_target;
|
|
|
|
|
2017-06-19 22:17:59 +00:00
|
|
|
/*! Log filter function */
|
2010-03-26 13:24:24 +00:00
|
|
|
typedef int log_filter(const struct log_context *ctx,
|
|
|
|
struct log_target *target);
|
|
|
|
|
2013-06-06 05:33:54 +00:00
|
|
|
struct log_info;
|
|
|
|
struct vty;
|
2016-12-02 14:30:02 +00:00
|
|
|
struct gsmtap_inst;
|
2013-06-06 05:33:54 +00:00
|
|
|
|
|
|
|
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);
|
|
|
|
|
2017-06-19 22:17:59 +00:00
|
|
|
/*! Logging configuration, passed to \ref log_init */
|
2010-03-26 13:24:24 +00:00
|
|
|
struct log_info {
|
2017-06-19 22:17:59 +00:00
|
|
|
/* filter callback function */
|
2010-03-26 13:24:24 +00:00
|
|
|
log_filter *filter_fn;
|
|
|
|
|
2017-06-19 22:17:59 +00:00
|
|
|
/*! per-category information */
|
2012-09-11 08:31:29 +00:00
|
|
|
const struct log_info_cat *cat;
|
2017-06-19 22:17:59 +00:00
|
|
|
/*! total number of categories */
|
2010-03-26 13:24:24 +00:00
|
|
|
unsigned int num_cat;
|
2017-06-19 22:17:59 +00:00
|
|
|
/*! total number of user categories (not library) */
|
2011-06-27 08:29:17 +00:00
|
|
|
unsigned int num_cat_user;
|
2013-06-06 05:33:54 +00:00
|
|
|
|
2017-06-19 22:17:59 +00:00
|
|
|
/*! filter saving function */
|
2013-06-06 05:33:54 +00:00
|
|
|
log_save_filters *save_fn;
|
2017-06-19 22:17:59 +00:00
|
|
|
/*! filter saving function */
|
2013-06-06 05:33:54 +00:00
|
|
|
log_print_filters *print_fn;
|
2010-03-26 13:24:24 +00:00
|
|
|
};
|
|
|
|
|
2017-06-19 22:17:59 +00:00
|
|
|
/*! Type of logging target */
|
2011-02-18 19:37:04 +00:00
|
|
|
enum log_target_type {
|
2017-06-19 22:17:59 +00:00
|
|
|
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 */
|
2011-02-18 19:37:04 +00:00
|
|
|
};
|
|
|
|
|
2017-06-19 22:17:59 +00:00
|
|
|
/*! structure representing a logging target */
|
2010-03-26 13:24:24 +00:00
|
|
|
struct log_target {
|
2017-06-19 22:17:59 +00:00
|
|
|
struct llist_head entry; /*!< linked list */
|
2010-03-26 13:24:24 +00:00
|
|
|
|
2017-06-19 22:17:59 +00:00
|
|
|
/*! Internal data for filtering */
|
2010-03-26 13:24:24 +00:00
|
|
|
int filter_map;
|
2017-06-19 22:17:59 +00:00
|
|
|
/*! Internal data for filtering */
|
2010-03-26 13:24:24 +00:00
|
|
|
void *filter_data[LOG_MAX_FILTERS+1];
|
|
|
|
|
2017-06-19 22:17:59 +00:00
|
|
|
/*! logging categories */
|
2011-06-27 08:29:17 +00:00
|
|
|
struct log_category *categories;
|
|
|
|
|
2017-06-19 22:17:59 +00:00
|
|
|
/*! global log level */
|
2010-03-26 13:24:24 +00:00
|
|
|
uint8_t loglevel;
|
2017-06-19 22:17:59 +00:00
|
|
|
/*! should color be used when printing log messages? */
|
2011-07-16 09:57:53 +00:00
|
|
|
unsigned int use_color:1;
|
2017-06-19 22:17:59 +00:00
|
|
|
/*! should log messages be prefixed with a timestamp? */
|
2011-07-16 09:57:53 +00:00
|
|
|
unsigned int print_timestamp:1;
|
2017-06-19 22:17:59 +00:00
|
|
|
/*! should log messages be prefixed with a filename? */
|
2012-09-11 09:24:51 +00:00
|
|
|
unsigned int print_filename:1;
|
2017-06-19 22:17:59 +00:00
|
|
|
/*! should log messages be prefixed with a category name? */
|
2014-12-05 08:35:30 +00:00
|
|
|
unsigned int print_category:1;
|
2017-06-19 22:17:59 +00:00
|
|
|
/*! should log messages be prefixed with an extended timestamp? */
|
2014-12-05 08:35:30 +00:00
|
|
|
unsigned int print_ext_timestamp:1;
|
2010-03-26 13:24:24 +00:00
|
|
|
|
2017-06-19 22:17:59 +00:00
|
|
|
/*! the type of this log taget */
|
2011-02-18 19:37:04 +00:00
|
|
|
enum log_target_type type;
|
|
|
|
|
2010-03-26 13:24:24 +00:00
|
|
|
union {
|
|
|
|
struct {
|
|
|
|
FILE *out;
|
2010-08-25 17:24:00 +00:00
|
|
|
const char *fname;
|
2010-08-25 12:55:44 +00:00
|
|
|
} tgt_file;
|
2010-03-26 13:24:24 +00:00
|
|
|
|
|
|
|
struct {
|
|
|
|
int priority;
|
2011-02-18 19:37:04 +00:00
|
|
|
int facility;
|
2010-03-26 13:24:24 +00:00
|
|
|
} tgt_syslog;
|
|
|
|
|
|
|
|
struct {
|
|
|
|
void *vty;
|
|
|
|
} tgt_vty;
|
2013-02-21 05:16:29 +00:00
|
|
|
|
|
|
|
struct {
|
|
|
|
void *rb;
|
|
|
|
} tgt_rb;
|
2016-12-02 14:30:02 +00:00
|
|
|
|
|
|
|
struct {
|
|
|
|
struct gsmtap_inst *gsmtap_inst;
|
|
|
|
const char *ident;
|
|
|
|
const char *hostname;
|
|
|
|
} tgt_gsmtap;
|
2010-03-26 13:24:24 +00:00
|
|
|
};
|
|
|
|
|
2017-06-19 22:17:59 +00:00
|
|
|
/*! call-back function to be called when the logging framework
|
2016-12-02 12:52:59 +00:00
|
|
|
* wants to log a fully formatted string
|
2013-02-15 12:27:59 +00:00
|
|
|
* \param[in] target logging target
|
2011-08-17 12:14:17 +00:00
|
|
|
* \param[in] level log level of currnet message
|
|
|
|
* \param[in] string the string that is to be written to the log
|
|
|
|
*/
|
2011-02-17 14:52:39 +00:00
|
|
|
void (*output) (struct log_target *target, unsigned int level,
|
|
|
|
const char *string);
|
2016-12-02 12:52:59 +00:00
|
|
|
|
2017-06-19 22:17:59 +00:00
|
|
|
/*! alternative call-back function to which the logging
|
2016-12-02 12:52:59 +00:00
|
|
|
* framework passes the unfortmatted input arguments,
|
|
|
|
* i.e. bypassing the internal string formatter
|
|
|
|
* \param[in] target logging target
|
|
|
|
* \param[in] subsys logging sub-system
|
|
|
|
* \param[in] level logging level
|
|
|
|
* \param[in] file soure code file name
|
|
|
|
* \param[in] line source code file line number
|
|
|
|
* \param[in] cont continuation of previous statement?
|
|
|
|
* \param[in] format format string
|
|
|
|
* \param[in] ap vararg list of printf arguments
|
|
|
|
*/
|
|
|
|
void (*raw_output)(struct log_target *target, int subsys,
|
|
|
|
unsigned int level, const char *file, int line,
|
|
|
|
int cont, const char *format, va_list ap);
|
2010-03-26 13:24:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* use the above macros */
|
2012-07-10 11:10:15 +00:00
|
|
|
void logp2(int subsys, unsigned int level, const char *file,
|
2010-03-26 13:24:24 +00:00
|
|
|
int line, int cont, const char *format, ...)
|
|
|
|
__attribute__ ((format (printf, 6, 7)));
|
2011-06-27 08:29:17 +00:00
|
|
|
int log_init(const struct log_info *inf, void *talloc_ctx);
|
2016-04-20 08:41:27 +00:00
|
|
|
void log_fini(void);
|
2015-11-17 10:52:24 +00:00
|
|
|
int log_check_level(int subsys, unsigned int level);
|
2010-03-26 13:24:24 +00:00
|
|
|
|
|
|
|
/* context management */
|
|
|
|
void log_reset_context(void);
|
|
|
|
int log_set_context(uint8_t ctx, void *value);
|
|
|
|
|
|
|
|
/* filter on the targets */
|
|
|
|
void log_set_all_filter(struct log_target *target, int);
|
|
|
|
|
|
|
|
void log_set_use_color(struct log_target *target, int);
|
2014-12-05 08:35:30 +00:00
|
|
|
void log_set_print_extended_timestamp(struct log_target *target, int);
|
2010-03-26 13:24:24 +00:00
|
|
|
void log_set_print_timestamp(struct log_target *target, int);
|
2012-09-11 09:24:51 +00:00
|
|
|
void log_set_print_filename(struct log_target *target, int);
|
2014-12-05 08:35:30 +00:00
|
|
|
void log_set_print_category(struct log_target *target, int);
|
2010-03-26 13:24:24 +00:00
|
|
|
void log_set_log_level(struct log_target *target, int log_level);
|
|
|
|
void log_parse_category_mask(struct log_target *target, const char* mask);
|
2016-12-02 14:30:02 +00:00
|
|
|
const char* log_category_name(int subsys);
|
2010-03-26 13:24:24 +00:00
|
|
|
int log_parse_level(const char *lvl);
|
2010-05-11 09:19:40 +00:00
|
|
|
const char *log_level_str(unsigned int lvl);
|
2010-03-26 13:24:24 +00:00
|
|
|
int log_parse_category(const char *category);
|
|
|
|
void log_set_category_filter(struct log_target *target, int category,
|
|
|
|
int enable, int level);
|
|
|
|
|
|
|
|
/* management of the targets */
|
|
|
|
struct log_target *log_target_create(void);
|
2010-08-25 17:24:00 +00:00
|
|
|
void log_target_destroy(struct log_target *target);
|
2010-03-26 13:24:24 +00:00
|
|
|
struct log_target *log_target_create_stderr(void);
|
2010-08-25 17:24:00 +00:00
|
|
|
struct log_target *log_target_create_file(const char *fname);
|
2011-02-17 14:56:56 +00:00
|
|
|
struct log_target *log_target_create_syslog(const char *ident, int option,
|
|
|
|
int facility);
|
2016-12-02 14:30:02 +00:00
|
|
|
struct log_target *log_target_create_gsmtap(const char *host, uint16_t port,
|
|
|
|
const char *ident,
|
|
|
|
bool ofd_wq_mode,
|
|
|
|
bool add_sink);
|
2010-08-25 17:24:00 +00:00
|
|
|
int log_target_file_reopen(struct log_target *tgt);
|
2013-03-18 18:01:40 +00:00
|
|
|
int log_targets_reopen(void);
|
2010-08-25 17:24:00 +00:00
|
|
|
|
2010-03-26 13:24:24 +00:00
|
|
|
void log_add_target(struct log_target *target);
|
|
|
|
void log_del_target(struct log_target *target);
|
|
|
|
|
2011-03-09 12:05:08 +00:00
|
|
|
/* Generate command string for VTY use */
|
2017-06-17 21:18:11 +00:00
|
|
|
const char *log_vty_command_string() OSMO_DEPRECATED_OUTSIDE_LIBOSMOCORE;
|
|
|
|
const char *log_vty_command_description() OSMO_DEPRECATED_OUTSIDE_LIBOSMOCORE;
|
2010-05-11 14:39:22 +00:00
|
|
|
|
2011-02-18 19:37:04 +00:00
|
|
|
struct log_target *log_target_find(int type, const char *fname);
|
|
|
|
extern struct llist_head osmo_log_target_list;
|
|
|
|
|
2012-04-18 19:53:23 +00:00
|
|
|
/*! @} */
|