blob: 1e809d0a207fa9e121f12e329c4a792c648eb74c [file] [log] [blame]
Sylvain Munaut12ba7782014-06-16 10:13:40 +02001#pragma once
Harald Welte3ae27582010-03-26 21:24:24 +08002
Harald Welte18fc4652011-08-17 14:14:17 +02003/*! \defgroup logging Osmocom logging framework
4 * @{
Neels Hofmeyr17518fe2017-06-20 04:35:06 +02005 * \file logging.h */
Harald Welte18fc4652011-08-17 14:14:17 +02006
Harald Welte3ae27582010-03-26 21:24:24 +08007#include <stdio.h>
8#include <stdint.h>
Christoph Fritzab7c9c72011-09-01 16:22:17 +02009#include <stdarg.h>
Harald Welteaa00f992016-12-02 15:30:02 +010010#include <stdbool.h>
Maxaa1bc012017-01-13 11:01:12 +010011#include <osmocom/core/defs.h>
Pablo Neira Ayuso83419342011-03-22 16:36:13 +010012#include <osmocom/core/linuxlist.h>
Harald Welte3ae27582010-03-26 21:24:24 +080013
Neels Hofmeyr87e45502017-06-20 00:17:59 +020014/*! Maximum number of logging contexts */
Harald Welte3ae27582010-03-26 21:24:24 +080015#define LOG_MAX_CTX 8
Neels Hofmeyr87e45502017-06-20 00:17:59 +020016/*! Maximum number of logging filters */
Harald Welte3ae27582010-03-26 21:24:24 +080017#define LOG_MAX_FILTERS 8
18
19#define DEBUG
20
21#ifdef DEBUG
Neels Hofmeyr87e45502017-06-20 00:17:59 +020022/*! Log a debug message through the Osmocom logging framework
Harald Welte2d2e2cc2016-04-25 12:11:20 +020023 * \param[in] ss logging subsystem (e.g. \ref DLGLOBAL)
24 * \param[in] fmt format string
25 * \param[in] args variable argument list
26 */
Maxaa1bc012017-01-13 11:01:12 +010027#define DEBUGP(ss, fmt, args...) LOGP(ss, LOGL_DEBUG, fmt, ##args)
28#define DEBUGPC(ss, fmt, args...) LOGPC(ss, LOGL_DEBUG, fmt, ##args)
Harald Welte3ae27582010-03-26 21:24:24 +080029#else
30#define DEBUGP(xss, fmt, args...)
31#define DEBUGPC(ss, fmt, args...)
32#endif
33
Harald Welte3ae27582010-03-26 21:24:24 +080034
Holger Hans Peter Freytherfb4bfc22012-07-12 09:26:25 +020035void osmo_vlogp(int subsys, int level, const char *file, int line,
Harald Welte36c5a3e2011-08-27 14:33:19 +020036 int cont, const char *format, va_list ap);
37
Maxaa1bc012017-01-13 11:01:12 +010038void logp(int subsys, const char *file, int line, int cont, const char *format, ...) OSMO_DEPRECATED("Use DEBUGP* macros instead");
Harald Welte3ae27582010-03-26 21:24:24 +080039
Neels Hofmeyr87e45502017-06-20 00:17:59 +020040/*! Log a new message through the Osmocom logging framework
Harald Weltebd598e32011-08-16 23:26:52 +020041 * \param[in] ss logging subsystem (e.g. \ref DLGLOBAL)
42 * \param[in] level logging level (e.g. \ref LOGL_NOTICE)
43 * \param[in] fmt format string
44 * \param[in] args variable argument list
45 */
Harald Welte3ae27582010-03-26 21:24:24 +080046#define LOGP(ss, level, fmt, args...) \
Neels Hofmeyr725698a2016-12-14 17:24:54 +010047 LOGPSRC(ss, level, NULL, 0, fmt, ## args)
Harald Weltebd598e32011-08-16 23:26:52 +020048
Neels Hofmeyr87e45502017-06-20 00:17:59 +020049/*! Continue a log message through the Osmocom logging framework
Harald Weltebd598e32011-08-16 23:26:52 +020050 * \param[in] ss logging subsystem (e.g. \ref DLGLOBAL)
51 * \param[in] level logging level (e.g. \ref LOGL_NOTICE)
52 * \param[in] fmt format string
53 * \param[in] args variable argument list
54 */
Harald Welte3ae27582010-03-26 21:24:24 +080055#define LOGPC(ss, level, fmt, args...) \
Jacob Erlbecka89d22c2015-11-17 11:52:25 +010056 do { \
57 if (log_check_level(ss, level)) \
Harald Welte3d792402016-05-10 15:23:06 +020058 logp2(ss, level, __BASE_FILE__, __LINE__, 1, fmt, ##args); \
Jacob Erlbecka89d22c2015-11-17 11:52:25 +010059 } while(0)
Harald Welte3ae27582010-03-26 21:24:24 +080060
Neels Hofmeyr87e45502017-06-20 00:17:59 +020061/*! Log through the Osmocom logging framework with explicit source.
Neels Hofmeyr725698a2016-12-14 17:24:54 +010062 * If caller_file is passed as NULL, __BASE_FILE__ and __LINE__ are used
63 * instead of caller_file and caller_line (so that this macro here defines
64 * both cases in the same place, and to catch cases where callers fail to pass
65 * a non-null filename string).
66 * \param[in] ss logging subsystem (e.g. \ref DLGLOBAL)
67 * \param[in] level logging level (e.g. \ref LOGL_NOTICE)
68 * \param[in] caller_file caller's source file string (e.g. __BASE_FILE__)
69 * \param[in] caller_line caller's source line nr (e.g. __LINE__)
70 * \param[in] fmt format string
71 * \param[in] args variable argument list
72 */
73#define LOGPSRC(ss, level, caller_file, caller_line, fmt, args...) \
Holger Hans Peter Freyther37a83402017-11-29 11:46:39 +080074 LOGPSRCC(ss, level, caller_file, caller_line, 0, fmt, ##args)
75
76/*! Log through the Osmocom logging framework with explicit source.
77 * If caller_file is passed as NULL, __BASE_FILE__ and __LINE__ are used
78 * instead of caller_file and caller_line (so that this macro here defines
79 * both cases in the same place, and to catch cases where callers fail to pass
80 * a non-null filename string).
81 * \param[in] ss logging subsystem (e.g. \ref DLGLOBAL)
82 * \param[in] level logging level (e.g. \ref LOGL_NOTICE)
83 * \param[in] caller_file caller's source file string (e.g. __BASE_FILE__)
84 * \param[in] caller_line caller's source line nr (e.g. __LINE__)
85 * \param[in] cont continuation (1) or new line (0)
86 * \param[in] fmt format string
87 * \param[in] args variable argument list
88 */
89#define LOGPSRCC(ss, level, caller_file, caller_line, cont, fmt, args...) \
Neels Hofmeyr725698a2016-12-14 17:24:54 +010090 do { \
91 if (log_check_level(ss, level)) {\
92 if (caller_file) \
Holger Hans Peter Freyther37a83402017-11-29 11:46:39 +080093 logp2(ss, level, caller_file, caller_line, cont, fmt, ##args); \
Neels Hofmeyr725698a2016-12-14 17:24:54 +010094 else \
Holger Hans Peter Freyther37a83402017-11-29 11:46:39 +080095 logp2(ss, level, __BASE_FILE__, __LINE__, cont, fmt, ##args); \
Neels Hofmeyr725698a2016-12-14 17:24:54 +010096 }\
97 } while(0)
98
Neels Hofmeyr87e45502017-06-20 00:17:59 +020099/*! different log levels */
100#define LOGL_DEBUG 1 /*!< debugging information */
101#define LOGL_INFO 3 /*!< general information */
102#define LOGL_NOTICE 5 /*!< abnormal/unexpected condition */
103#define LOGL_ERROR 7 /*!< error condition, requires user action */
104#define LOGL_FATAL 8 /*!< fatal, program aborted */
Harald Welte3ae27582010-03-26 21:24:24 +0800105
Harald Welteb43bc042011-06-27 10:29:17 +0200106/* logging levels defined by the library itself */
Harald Welte2d2e2cc2016-04-25 12:11:20 +0200107#define DLGLOBAL -1 /*!< global logging */
108#define DLLAPD -2 /*!< LAPD implementation */
109#define DLINP -3 /*!< (A-bis) Input sub-system */
110#define DLMUX -4 /*!< Osmocom Multiplex (Osmux) */
111#define DLMI -5 /*!< ISDN-layer below input sub-system */
112#define DLMIB -6 /*!< ISDN layer B-channel */
113#define DLSMS -7 /*!< SMS sub-system */
114#define DLCTRL -8 /*!< Control Interface */
115#define DLGTP -9 /*!< GTP (GPRS Tunneling Protocol */
116#define DLSTATS -10 /*!< Statistics */
Neels Hofmeyr9795cf12016-12-10 17:01:06 +0100117#define DLGSUP -11 /*!< Generic Subscriber Update Protocol */
Harald Weltec0f00072016-04-27 18:32:35 +0200118#define DLOAP -12 /*!< Osmocom Authentication Protocol */
Harald Welte62d32962017-04-03 19:37:11 +0200119#define DLSS7 -13 /*!< Osmocom SS7 */
120#define DLSCCP -14 /*!< Osmocom SCCP */
121#define DLSUA -15 /*!< Osmocom SUA */
122#define DLM3UA -16 /*!< Osmocom M3UA */
Neels Hofmeyra7ccf612017-07-11 18:43:09 +0200123#define DLMGCP -17 /*!< Osmocom MGCP */
124#define OSMO_NUM_DLIB 17 /*!< Number of logging sub-systems in libraries */
Harald Welteb43bc042011-06-27 10:29:17 +0200125
Neels Hofmeyrfc47b032017-06-20 04:29:38 +0200126/*! Configuration of single log category / sub-system */
Harald Welte3ae27582010-03-26 21:24:24 +0800127struct log_category {
Harald Welte2d2e2cc2016-04-25 12:11:20 +0200128 uint8_t loglevel; /*!< configured log-level */
129 uint8_t enabled; /*!< is logging enabled? */
Harald Welte3ae27582010-03-26 21:24:24 +0800130};
131
Neels Hofmeyr87e45502017-06-20 00:17:59 +0200132/*! Information regarding one logging category */
Harald Welte3ae27582010-03-26 21:24:24 +0800133struct log_info_cat {
Harald Welte18fc4652011-08-17 14:14:17 +0200134 const char *name; /*!< name of category */
135 const char *color; /*!< color string for cateyory */
136 const char *description; /*!< description text */
137 uint8_t loglevel; /*!< currently selected log-level */
138 uint8_t enabled; /*!< is this category enabled or not */
Harald Welte3ae27582010-03-26 21:24:24 +0800139};
140
Neels Hofmeyr87e45502017-06-20 00:17:59 +0200141/*! Log context information, passed to filter */
Harald Welte3ae27582010-03-26 21:24:24 +0800142struct log_context {
143 void *ctx[LOG_MAX_CTX+1];
144};
145
Neels Hofmeyr87e45502017-06-20 00:17:59 +0200146/*! Indexes to indicate the object currently acted upon.
Neels Hofmeyr492e1802017-02-23 17:45:26 +0100147 * Array indexes for the global \a log_context array. */
Neels Hofmeyr8b86cd72017-02-23 18:03:28 +0100148enum log_ctx_index {
149 LOG_CTX_GB_NSVC,
150 LOG_CTX_GB_BVC,
151 LOG_CTX_BSC_SUBSCR,
152 LOG_CTX_VLR_SUBSCR,
153 _LOG_CTX_COUNT
Neels Hofmeyr812ba6d2017-02-17 16:35:27 +0100154};
155
Neels Hofmeyr87e45502017-06-20 00:17:59 +0200156/*! Indexes to indicate objects that should be logged.
Neels Hofmeyr492e1802017-02-23 17:45:26 +0100157 * Array indexes to log_target->filter_data and bit indexes for
158 * log_target->filter_map. */
Neels Hofmeyr8b86cd72017-02-23 18:03:28 +0100159enum log_filter_index {
160 LOG_FLT_ALL,
161 LOG_FLT_GB_NSVC,
162 LOG_FLT_GB_BVC,
163 LOG_FLT_BSC_SUBSCR,
164 LOG_FLT_VLR_SUBSCR,
165 _LOG_FLT_COUNT
Neels Hofmeyr812ba6d2017-02-17 16:35:27 +0100166};
167
Neels Hofmeyr87e45502017-06-20 00:17:59 +0200168/*! Compatibility with older libosmocore versions */
Neels Hofmeyr8b86cd72017-02-23 18:03:28 +0100169#define LOG_FILTER_ALL (1<<LOG_FLT_ALL)
Neels Hofmeyr87e45502017-06-20 00:17:59 +0200170/*! Compatibility with older libosmocore versions */
Neels Hofmeyr8b86cd72017-02-23 18:03:28 +0100171#define GPRS_CTX_NSVC LOG_CTX_GB_NSVC
Neels Hofmeyr87e45502017-06-20 00:17:59 +0200172/*! Compatibility with older libosmocore versions */
Neels Hofmeyr8b86cd72017-02-23 18:03:28 +0100173#define GPRS_CTX_BVC LOG_CTX_GB_BVC
Neels Hofmeyr87e45502017-06-20 00:17:59 +0200174/*! Indexes to indicate the object currently acted upon.
Neels Hofmeyr8b86cd72017-02-23 18:03:28 +0100175 * Array indexes for the global \a log_context array. */
Neels Hofmeyr0d6420b2017-02-23 17:34:35 +0100176
Harald Welte3ae27582010-03-26 21:24:24 +0800177struct log_target;
178
Neels Hofmeyr87e45502017-06-20 00:17:59 +0200179/*! Log filter function */
Harald Welte3ae27582010-03-26 21:24:24 +0800180typedef int log_filter(const struct log_context *ctx,
181 struct log_target *target);
182
Harald Weltefb84f322013-06-06 07:33:54 +0200183struct log_info;
184struct vty;
Harald Welteaa00f992016-12-02 15:30:02 +0100185struct gsmtap_inst;
Harald Weltefb84f322013-06-06 07:33:54 +0200186
187typedef void log_print_filters(struct vty *vty,
188 const struct log_info *info,
189 const struct log_target *tgt);
190
191typedef void log_save_filters(struct vty *vty,
192 const struct log_info *info,
193 const struct log_target *tgt);
194
Neels Hofmeyr87e45502017-06-20 00:17:59 +0200195/*! Logging configuration, passed to \ref log_init */
Harald Welte3ae27582010-03-26 21:24:24 +0800196struct log_info {
Neels Hofmeyr87e45502017-06-20 00:17:59 +0200197 /* filter callback function */
Harald Welte3ae27582010-03-26 21:24:24 +0800198 log_filter *filter_fn;
199
Neels Hofmeyr87e45502017-06-20 00:17:59 +0200200 /*! per-category information */
Holger Hans Peter Freyther06f64552012-09-11 10:31:29 +0200201 const struct log_info_cat *cat;
Neels Hofmeyr87e45502017-06-20 00:17:59 +0200202 /*! total number of categories */
Harald Welte3ae27582010-03-26 21:24:24 +0800203 unsigned int num_cat;
Neels Hofmeyr87e45502017-06-20 00:17:59 +0200204 /*! total number of user categories (not library) */
Harald Welteb43bc042011-06-27 10:29:17 +0200205 unsigned int num_cat_user;
Harald Weltefb84f322013-06-06 07:33:54 +0200206
Neels Hofmeyr87e45502017-06-20 00:17:59 +0200207 /*! filter saving function */
Harald Weltefb84f322013-06-06 07:33:54 +0200208 log_save_filters *save_fn;
Neels Hofmeyr87e45502017-06-20 00:17:59 +0200209 /*! filter saving function */
Harald Weltefb84f322013-06-06 07:33:54 +0200210 log_print_filters *print_fn;
Harald Welte3ae27582010-03-26 21:24:24 +0800211};
212
Neels Hofmeyr87e45502017-06-20 00:17:59 +0200213/*! Type of logging target */
Harald Welte28222962011-02-18 20:37:04 +0100214enum log_target_type {
Neels Hofmeyr87e45502017-06-20 00:17:59 +0200215 LOG_TGT_TYPE_VTY, /*!< VTY logging */
216 LOG_TGT_TYPE_SYSLOG, /*!< syslog based logging */
217 LOG_TGT_TYPE_FILE, /*!< text file logging */
218 LOG_TGT_TYPE_STDERR, /*!< stderr logging */
219 LOG_TGT_TYPE_STRRB, /*!< osmo_strrb-backed logging */
220 LOG_TGT_TYPE_GSMTAP, /*!< GSMTAP network logging */
Harald Welte28222962011-02-18 20:37:04 +0100221};
222
Neels Hofmeyr87e45502017-06-20 00:17:59 +0200223/*! structure representing a logging target */
Harald Welte3ae27582010-03-26 21:24:24 +0800224struct log_target {
Neels Hofmeyr87e45502017-06-20 00:17:59 +0200225 struct llist_head entry; /*!< linked list */
Harald Welte3ae27582010-03-26 21:24:24 +0800226
Neels Hofmeyr87e45502017-06-20 00:17:59 +0200227 /*! Internal data for filtering */
Harald Welte3ae27582010-03-26 21:24:24 +0800228 int filter_map;
Neels Hofmeyr87e45502017-06-20 00:17:59 +0200229 /*! Internal data for filtering */
Harald Welte3ae27582010-03-26 21:24:24 +0800230 void *filter_data[LOG_MAX_FILTERS+1];
231
Neels Hofmeyr87e45502017-06-20 00:17:59 +0200232 /*! logging categories */
Harald Welteb43bc042011-06-27 10:29:17 +0200233 struct log_category *categories;
234
Neels Hofmeyr87e45502017-06-20 00:17:59 +0200235 /*! global log level */
Harald Welte3ae27582010-03-26 21:24:24 +0800236 uint8_t loglevel;
Neels Hofmeyr87e45502017-06-20 00:17:59 +0200237 /*! should color be used when printing log messages? */
Harald Welte87dbca12011-07-16 11:57:53 +0200238 unsigned int use_color:1;
Neels Hofmeyr87e45502017-06-20 00:17:59 +0200239 /*! should log messages be prefixed with a timestamp? */
Harald Welte87dbca12011-07-16 11:57:53 +0200240 unsigned int print_timestamp:1;
Neels Hofmeyr87e45502017-06-20 00:17:59 +0200241 /*! should log messages be prefixed with a filename? */
Holger Hans Peter Freytherdb153362012-09-11 11:24:51 +0200242 unsigned int print_filename:1;
Neels Hofmeyr87e45502017-06-20 00:17:59 +0200243 /*! should log messages be prefixed with a category name? */
Holger Hans Peter Freyther2d6ad132014-12-05 09:35:30 +0100244 unsigned int print_category:1;
Neels Hofmeyr87e45502017-06-20 00:17:59 +0200245 /*! should log messages be prefixed with an extended timestamp? */
Holger Hans Peter Freyther2d6ad132014-12-05 09:35:30 +0100246 unsigned int print_ext_timestamp:1;
Harald Welte3ae27582010-03-26 21:24:24 +0800247
Neels Hofmeyr87e45502017-06-20 00:17:59 +0200248 /*! the type of this log taget */
Harald Welte28222962011-02-18 20:37:04 +0100249 enum log_target_type type;
250
Harald Welte3ae27582010-03-26 21:24:24 +0800251 union {
252 struct {
253 FILE *out;
Harald Welte72d0c532010-08-25 19:24:00 +0200254 const char *fname;
Harald Welte0083cd32010-08-25 14:55:44 +0200255 } tgt_file;
Harald Welte3ae27582010-03-26 21:24:24 +0800256
257 struct {
258 int priority;
Harald Welte28222962011-02-18 20:37:04 +0100259 int facility;
Harald Welte3ae27582010-03-26 21:24:24 +0800260 } tgt_syslog;
261
262 struct {
263 void *vty;
264 } tgt_vty;
Katerina Barone-Adesi3309a432013-02-21 05:16:29 +0000265
266 struct {
267 void *rb;
268 } tgt_rb;
Harald Welteaa00f992016-12-02 15:30:02 +0100269
270 struct {
271 struct gsmtap_inst *gsmtap_inst;
272 const char *ident;
273 const char *hostname;
274 } tgt_gsmtap;
Harald Welte3ae27582010-03-26 21:24:24 +0800275 };
276
Neels Hofmeyr87e45502017-06-20 00:17:59 +0200277 /*! call-back function to be called when the logging framework
Harald Welted7c0a372016-12-02 13:52:59 +0100278 * wants to log a fully formatted string
Katerina Barone-Adesic28c6a02013-02-15 13:27:59 +0100279 * \param[in] target logging target
Harald Welte18fc4652011-08-17 14:14:17 +0200280 * \param[in] level log level of currnet message
281 * \param[in] string the string that is to be written to the log
282 */
Harald Welte76e72ab2011-02-17 15:52:39 +0100283 void (*output) (struct log_target *target, unsigned int level,
284 const char *string);
Harald Welted7c0a372016-12-02 13:52:59 +0100285
Neels Hofmeyr87e45502017-06-20 00:17:59 +0200286 /*! alternative call-back function to which the logging
Harald Welted7c0a372016-12-02 13:52:59 +0100287 * framework passes the unfortmatted input arguments,
288 * i.e. bypassing the internal string formatter
289 * \param[in] target logging target
290 * \param[in] subsys logging sub-system
291 * \param[in] level logging level
292 * \param[in] file soure code file name
293 * \param[in] line source code file line number
294 * \param[in] cont continuation of previous statement?
295 * \param[in] format format string
296 * \param[in] ap vararg list of printf arguments
297 */
298 void (*raw_output)(struct log_target *target, int subsys,
299 unsigned int level, const char *file, int line,
300 int cont, const char *format, va_list ap);
Neels Hofmeyr886e5482018-01-16 01:49:37 +0100301
302 /* Should the log level be printed? */
303 bool print_level;
Harald Welte3ae27582010-03-26 21:24:24 +0800304};
305
306/* use the above macros */
Andreas Eversberg2d6563b2012-07-10 13:10:15 +0200307void logp2(int subsys, unsigned int level, const char *file,
Harald Welte3ae27582010-03-26 21:24:24 +0800308 int line, int cont, const char *format, ...)
309 __attribute__ ((format (printf, 6, 7)));
Harald Welteb43bc042011-06-27 10:29:17 +0200310int log_init(const struct log_info *inf, void *talloc_ctx);
Harald Welte69e6c3c2016-04-20 10:41:27 +0200311void log_fini(void);
Jacob Erlbeckde6dd722015-11-17 11:52:24 +0100312int log_check_level(int subsys, unsigned int level);
Harald Welte3ae27582010-03-26 21:24:24 +0800313
314/* context management */
315void log_reset_context(void);
316int log_set_context(uint8_t ctx, void *value);
317
318/* filter on the targets */
319void log_set_all_filter(struct log_target *target, int);
320
321void log_set_use_color(struct log_target *target, int);
Holger Hans Peter Freyther2d6ad132014-12-05 09:35:30 +0100322void log_set_print_extended_timestamp(struct log_target *target, int);
Harald Welte3ae27582010-03-26 21:24:24 +0800323void log_set_print_timestamp(struct log_target *target, int);
Holger Hans Peter Freytherdb153362012-09-11 11:24:51 +0200324void log_set_print_filename(struct log_target *target, int);
Holger Hans Peter Freyther2d6ad132014-12-05 09:35:30 +0100325void log_set_print_category(struct log_target *target, int);
Neels Hofmeyr886e5482018-01-16 01:49:37 +0100326void log_set_print_level(struct log_target *target, int);
Harald Welte3ae27582010-03-26 21:24:24 +0800327void log_set_log_level(struct log_target *target, int log_level);
328void log_parse_category_mask(struct log_target *target, const char* mask);
Harald Welteaa00f992016-12-02 15:30:02 +0100329const char* log_category_name(int subsys);
Max15b6d412017-07-06 16:57:15 +0200330int log_parse_level(const char *lvl) OSMO_DEPRECATED_OUTSIDE_LIBOSMOCORE;
331const char *log_level_str(unsigned int lvl) OSMO_DEPRECATED_OUTSIDE_LIBOSMOCORE;
Harald Welte3ae27582010-03-26 21:24:24 +0800332int log_parse_category(const char *category);
333void log_set_category_filter(struct log_target *target, int category,
334 int enable, int level);
335
336/* management of the targets */
337struct log_target *log_target_create(void);
Harald Welte72d0c532010-08-25 19:24:00 +0200338void log_target_destroy(struct log_target *target);
Harald Welte3ae27582010-03-26 21:24:24 +0800339struct log_target *log_target_create_stderr(void);
Harald Welte72d0c532010-08-25 19:24:00 +0200340struct log_target *log_target_create_file(const char *fname);
Harald Welte46cfd772011-02-17 15:56:56 +0100341struct log_target *log_target_create_syslog(const char *ident, int option,
342 int facility);
Harald Welteaa00f992016-12-02 15:30:02 +0100343struct log_target *log_target_create_gsmtap(const char *host, uint16_t port,
344 const char *ident,
345 bool ofd_wq_mode,
346 bool add_sink);
Harald Welte72d0c532010-08-25 19:24:00 +0200347int log_target_file_reopen(struct log_target *tgt);
Harald Welte4de854d2013-03-18 19:01:40 +0100348int log_targets_reopen(void);
Harald Welte72d0c532010-08-25 19:24:00 +0200349
Harald Welte3ae27582010-03-26 21:24:24 +0800350void log_add_target(struct log_target *target);
351void log_del_target(struct log_target *target);
352
Pablo Neira Ayuso04139f12011-03-09 13:05:08 +0100353/* Generate command string for VTY use */
Pau Espin Pedrol69dfe5a2017-06-17 23:18:11 +0200354const char *log_vty_command_string() OSMO_DEPRECATED_OUTSIDE_LIBOSMOCORE;
355const char *log_vty_command_description() OSMO_DEPRECATED_OUTSIDE_LIBOSMOCORE;
Harald Welte7638af92010-05-11 16:39:22 +0200356
Harald Welte28222962011-02-18 20:37:04 +0100357struct log_target *log_target_find(int type, const char *fname);
358extern struct llist_head osmo_log_target_list;
359
Sylvain Munautdca7d2c2012-04-18 21:53:23 +0200360/*! @} */