Sylvain Munaut | 12ba778 | 2014-06-16 10:13:40 +0200 | [diff] [blame] | 1 | #pragma once |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 2 | |
Harald Welte | 18fc465 | 2011-08-17 14:14:17 +0200 | [diff] [blame] | 3 | /*! \defgroup logging Osmocom logging framework |
| 4 | * @{ |
Harald Welte | bd598e3 | 2011-08-16 23:26:52 +0200 | [diff] [blame] | 5 | */ |
| 6 | |
Harald Welte | 18fc465 | 2011-08-17 14:14:17 +0200 | [diff] [blame] | 7 | /*! \file logging.h */ |
| 8 | |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 9 | #include <stdio.h> |
| 10 | #include <stdint.h> |
Christoph Fritz | ab7c9c7 | 2011-09-01 16:22:17 +0200 | [diff] [blame] | 11 | #include <stdarg.h> |
Pablo Neira Ayuso | 8341934 | 2011-03-22 16:36:13 +0100 | [diff] [blame] | 12 | #include <osmocom/core/linuxlist.h> |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 13 | |
Harald Welte | bd598e3 | 2011-08-16 23:26:52 +0200 | [diff] [blame] | 14 | /*! \brief Maximum number of logging contexts */ |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 15 | #define LOG_MAX_CTX 8 |
Harald Welte | bd598e3 | 2011-08-16 23:26:52 +0200 | [diff] [blame] | 16 | /*! \brief Maximum number of logging filters */ |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 17 | #define LOG_MAX_FILTERS 8 |
| 18 | |
| 19 | #define DEBUG |
| 20 | |
| 21 | #ifdef DEBUG |
Harald Welte | 2d2e2cc | 2016-04-25 12:11:20 +0200 | [diff] [blame] | 22 | /*! \brief Log a debug message through the Osmocom logging framework |
| 23 | * \param[in] ss logging subsystem (e.g. \ref DLGLOBAL) |
| 24 | * \param[in] fmt format string |
| 25 | * \param[in] args variable argument list |
| 26 | */ |
Jacob Erlbeck | a89d22c | 2015-11-17 11:52:25 +0100 | [diff] [blame] | 27 | #define DEBUGP(ss, fmt, args...) \ |
| 28 | do { \ |
| 29 | if (log_check_level(ss, LOGL_DEBUG)) \ |
Harald Welte | 3d79240 | 2016-05-10 15:23:06 +0200 | [diff] [blame] | 30 | logp(ss, __BASE_FILE__, __LINE__, 0, fmt, ## args); \ |
Jacob Erlbeck | a89d22c | 2015-11-17 11:52:25 +0100 | [diff] [blame] | 31 | } while(0) |
| 32 | |
| 33 | #define DEBUGPC(ss, fmt, args...) \ |
| 34 | do { \ |
| 35 | if (log_check_level(ss, LOGL_DEBUG)) \ |
Harald Welte | 3d79240 | 2016-05-10 15:23:06 +0200 | [diff] [blame] | 36 | logp(ss, __BASE_FILE__, __LINE__, 1, fmt, ## args); \ |
Jacob Erlbeck | a89d22c | 2015-11-17 11:52:25 +0100 | [diff] [blame] | 37 | } while(0) |
| 38 | |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 39 | #else |
| 40 | #define DEBUGP(xss, fmt, args...) |
| 41 | #define DEBUGPC(ss, fmt, args...) |
| 42 | #endif |
| 43 | |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 44 | |
Holger Hans Peter Freyther | fb4bfc2 | 2012-07-12 09:26:25 +0200 | [diff] [blame] | 45 | void osmo_vlogp(int subsys, int level, const char *file, int line, |
Harald Welte | 36c5a3e | 2011-08-27 14:33:19 +0200 | [diff] [blame] | 46 | int cont, const char *format, va_list ap); |
| 47 | |
Andreas Eversberg | 2d6563b | 2012-07-10 13:10:15 +0200 | [diff] [blame] | 48 | void logp(int subsys, const char *file, int line, int cont, const char *format, ...) __attribute__ ((format (printf, 5, 6))); |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 49 | |
Harald Welte | bd598e3 | 2011-08-16 23:26:52 +0200 | [diff] [blame] | 50 | /*! \brief Log a new message through the Osmocom logging framework |
| 51 | * \param[in] ss logging subsystem (e.g. \ref DLGLOBAL) |
| 52 | * \param[in] level logging level (e.g. \ref LOGL_NOTICE) |
| 53 | * \param[in] fmt format string |
| 54 | * \param[in] args variable argument list |
| 55 | */ |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 56 | #define LOGP(ss, level, fmt, args...) \ |
Jacob Erlbeck | a89d22c | 2015-11-17 11:52:25 +0100 | [diff] [blame] | 57 | do { \ |
| 58 | if (log_check_level(ss, level)) \ |
Harald Welte | 3d79240 | 2016-05-10 15:23:06 +0200 | [diff] [blame] | 59 | logp2(ss, level, __BASE_FILE__, __LINE__, 0, fmt, ##args); \ |
Jacob Erlbeck | a89d22c | 2015-11-17 11:52:25 +0100 | [diff] [blame] | 60 | } while(0) |
Harald Welte | bd598e3 | 2011-08-16 23:26:52 +0200 | [diff] [blame] | 61 | |
| 62 | /*! \brief Continue a log message through the Osmocom logging framework |
| 63 | * \param[in] ss logging subsystem (e.g. \ref DLGLOBAL) |
| 64 | * \param[in] level logging level (e.g. \ref LOGL_NOTICE) |
| 65 | * \param[in] fmt format string |
| 66 | * \param[in] args variable argument list |
| 67 | */ |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 68 | #define LOGPC(ss, level, fmt, args...) \ |
Jacob Erlbeck | a89d22c | 2015-11-17 11:52:25 +0100 | [diff] [blame] | 69 | do { \ |
| 70 | if (log_check_level(ss, level)) \ |
Harald Welte | 3d79240 | 2016-05-10 15:23:06 +0200 | [diff] [blame] | 71 | logp2(ss, level, __BASE_FILE__, __LINE__, 1, fmt, ##args); \ |
Jacob Erlbeck | a89d22c | 2015-11-17 11:52:25 +0100 | [diff] [blame] | 72 | } while(0) |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 73 | |
Harald Welte | 18fc465 | 2011-08-17 14:14:17 +0200 | [diff] [blame] | 74 | /*! \brief different log levels */ |
| 75 | #define LOGL_DEBUG 1 /*!< \brief debugging information */ |
Harald Welte | 2d2e2cc | 2016-04-25 12:11:20 +0200 | [diff] [blame] | 76 | #define LOGL_INFO 3 /*!< \brief general information */ |
Harald Welte | 18fc465 | 2011-08-17 14:14:17 +0200 | [diff] [blame] | 77 | #define LOGL_NOTICE 5 /*!< \brief abnormal/unexpected condition */ |
| 78 | #define LOGL_ERROR 7 /*!< \brief error condition, requires user action */ |
| 79 | #define LOGL_FATAL 8 /*!< \brief fatal, program aborted */ |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 80 | |
| 81 | #define LOG_FILTER_ALL 0x0001 |
| 82 | |
Harald Welte | b43bc04 | 2011-06-27 10:29:17 +0200 | [diff] [blame] | 83 | /* logging levels defined by the library itself */ |
Harald Welte | 2d2e2cc | 2016-04-25 12:11:20 +0200 | [diff] [blame] | 84 | #define DLGLOBAL -1 /*!< global logging */ |
| 85 | #define DLLAPD -2 /*!< LAPD implementation */ |
| 86 | #define DLINP -3 /*!< (A-bis) Input sub-system */ |
| 87 | #define DLMUX -4 /*!< Osmocom Multiplex (Osmux) */ |
| 88 | #define DLMI -5 /*!< ISDN-layer below input sub-system */ |
| 89 | #define DLMIB -6 /*!< ISDN layer B-channel */ |
| 90 | #define DLSMS -7 /*!< SMS sub-system */ |
| 91 | #define DLCTRL -8 /*!< Control Interface */ |
| 92 | #define DLGTP -9 /*!< GTP (GPRS Tunneling Protocol */ |
| 93 | #define DLSTATS -10 /*!< Statistics */ |
Harald Welte | 3b6fb08 | 2016-04-25 18:46:22 +0200 | [diff] [blame] | 94 | #define DLGSUP 11 /*!< Generic Subscriber Update Protocol */ |
| 95 | #define OSMO_NUM_DLIB 11 /*!< Number of logging sub-systems in libraries */ |
Harald Welte | b43bc04 | 2011-06-27 10:29:17 +0200 | [diff] [blame] | 96 | |
Harald Welte | 2d2e2cc | 2016-04-25 12:11:20 +0200 | [diff] [blame] | 97 | /*! Configuration of singgle log category / sub-system */ |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 98 | struct log_category { |
Harald Welte | 2d2e2cc | 2016-04-25 12:11:20 +0200 | [diff] [blame] | 99 | uint8_t loglevel; /*!< configured log-level */ |
| 100 | uint8_t enabled; /*!< is logging enabled? */ |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 101 | }; |
| 102 | |
Harald Welte | 18fc465 | 2011-08-17 14:14:17 +0200 | [diff] [blame] | 103 | /*! \brief Information regarding one logging category */ |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 104 | struct log_info_cat { |
Harald Welte | 18fc465 | 2011-08-17 14:14:17 +0200 | [diff] [blame] | 105 | const char *name; /*!< name of category */ |
| 106 | const char *color; /*!< color string for cateyory */ |
| 107 | const char *description; /*!< description text */ |
| 108 | uint8_t loglevel; /*!< currently selected log-level */ |
| 109 | uint8_t enabled; /*!< is this category enabled or not */ |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 110 | }; |
| 111 | |
Harald Welte | 18fc465 | 2011-08-17 14:14:17 +0200 | [diff] [blame] | 112 | /*! \brief Log context information, passed to filter */ |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 113 | struct log_context { |
| 114 | void *ctx[LOG_MAX_CTX+1]; |
| 115 | }; |
| 116 | |
| 117 | struct log_target; |
| 118 | |
Harald Welte | 18fc465 | 2011-08-17 14:14:17 +0200 | [diff] [blame] | 119 | /*! \brief Log filter function */ |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 120 | typedef int log_filter(const struct log_context *ctx, |
| 121 | struct log_target *target); |
| 122 | |
Harald Welte | fb84f32 | 2013-06-06 07:33:54 +0200 | [diff] [blame] | 123 | struct log_info; |
| 124 | struct vty; |
| 125 | |
| 126 | typedef void log_print_filters(struct vty *vty, |
| 127 | const struct log_info *info, |
| 128 | const struct log_target *tgt); |
| 129 | |
| 130 | typedef void log_save_filters(struct vty *vty, |
| 131 | const struct log_info *info, |
| 132 | const struct log_target *tgt); |
| 133 | |
Harald Welte | 18fc465 | 2011-08-17 14:14:17 +0200 | [diff] [blame] | 134 | /*! \brief Logging configuration, passed to \ref log_init */ |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 135 | struct log_info { |
Harald Welte | 18fc465 | 2011-08-17 14:14:17 +0200 | [diff] [blame] | 136 | /* \brief filter callback function */ |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 137 | log_filter *filter_fn; |
| 138 | |
Harald Welte | 18fc465 | 2011-08-17 14:14:17 +0200 | [diff] [blame] | 139 | /*! \brief per-category information */ |
Holger Hans Peter Freyther | 06f6455 | 2012-09-11 10:31:29 +0200 | [diff] [blame] | 140 | const struct log_info_cat *cat; |
Harald Welte | 18fc465 | 2011-08-17 14:14:17 +0200 | [diff] [blame] | 141 | /*! \brief total number of categories */ |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 142 | unsigned int num_cat; |
Harald Welte | 18fc465 | 2011-08-17 14:14:17 +0200 | [diff] [blame] | 143 | /*! \brief total number of user categories (not library) */ |
Harald Welte | b43bc04 | 2011-06-27 10:29:17 +0200 | [diff] [blame] | 144 | unsigned int num_cat_user; |
Harald Welte | fb84f32 | 2013-06-06 07:33:54 +0200 | [diff] [blame] | 145 | |
Harald Welte | 2d2e2cc | 2016-04-25 12:11:20 +0200 | [diff] [blame] | 146 | /*! \brief filter saving function */ |
Harald Welte | fb84f32 | 2013-06-06 07:33:54 +0200 | [diff] [blame] | 147 | log_save_filters *save_fn; |
Harald Welte | 2d2e2cc | 2016-04-25 12:11:20 +0200 | [diff] [blame] | 148 | /*! \brief filter saving function */ |
Harald Welte | fb84f32 | 2013-06-06 07:33:54 +0200 | [diff] [blame] | 149 | log_print_filters *print_fn; |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 150 | }; |
| 151 | |
Harald Welte | 18fc465 | 2011-08-17 14:14:17 +0200 | [diff] [blame] | 152 | /*! \brief Type of logging target */ |
Harald Welte | 2822296 | 2011-02-18 20:37:04 +0100 | [diff] [blame] | 153 | enum log_target_type { |
Harald Welte | 18fc465 | 2011-08-17 14:14:17 +0200 | [diff] [blame] | 154 | LOG_TGT_TYPE_VTY, /*!< \brief VTY logging */ |
| 155 | LOG_TGT_TYPE_SYSLOG, /*!< \brief syslog based logging */ |
| 156 | LOG_TGT_TYPE_FILE, /*!< \brief text file logging */ |
| 157 | LOG_TGT_TYPE_STDERR, /*!< \brief stderr logging */ |
Katerina Barone-Adesi | 3309a43 | 2013-02-21 05:16:29 +0000 | [diff] [blame] | 158 | LOG_TGT_TYPE_STRRB, /*!< \brief osmo_strrb-backed logging */ |
Harald Welte | 2822296 | 2011-02-18 20:37:04 +0100 | [diff] [blame] | 159 | }; |
| 160 | |
Harald Welte | 18fc465 | 2011-08-17 14:14:17 +0200 | [diff] [blame] | 161 | /*! \brief structure representing a logging target */ |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 162 | struct log_target { |
Harald Welte | 18fc465 | 2011-08-17 14:14:17 +0200 | [diff] [blame] | 163 | struct llist_head entry; /*!< \brief linked list */ |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 164 | |
Harald Welte | 18fc465 | 2011-08-17 14:14:17 +0200 | [diff] [blame] | 165 | /*! \brief Internal data for filtering */ |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 166 | int filter_map; |
Harald Welte | 18fc465 | 2011-08-17 14:14:17 +0200 | [diff] [blame] | 167 | /*! \brief Internal data for filtering */ |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 168 | void *filter_data[LOG_MAX_FILTERS+1]; |
| 169 | |
Harald Welte | 18fc465 | 2011-08-17 14:14:17 +0200 | [diff] [blame] | 170 | /*! \brief logging categories */ |
Harald Welte | b43bc04 | 2011-06-27 10:29:17 +0200 | [diff] [blame] | 171 | struct log_category *categories; |
| 172 | |
Harald Welte | 18fc465 | 2011-08-17 14:14:17 +0200 | [diff] [blame] | 173 | /*! \brief global log level */ |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 174 | uint8_t loglevel; |
Harald Welte | 18fc465 | 2011-08-17 14:14:17 +0200 | [diff] [blame] | 175 | /*! \brief should color be used when printing log messages? */ |
Harald Welte | 87dbca1 | 2011-07-16 11:57:53 +0200 | [diff] [blame] | 176 | unsigned int use_color:1; |
Harald Welte | 18fc465 | 2011-08-17 14:14:17 +0200 | [diff] [blame] | 177 | /*! \brief should log messages be prefixed with a timestamp? */ |
Harald Welte | 87dbca1 | 2011-07-16 11:57:53 +0200 | [diff] [blame] | 178 | unsigned int print_timestamp:1; |
Holger Hans Peter Freyther | db15336 | 2012-09-11 11:24:51 +0200 | [diff] [blame] | 179 | /*! \brief should log messages be prefixed with a filename? */ |
| 180 | unsigned int print_filename:1; |
Holger Hans Peter Freyther | 2d6ad13 | 2014-12-05 09:35:30 +0100 | [diff] [blame] | 181 | /*! \brief should log messages be prefixed with a category name? */ |
| 182 | unsigned int print_category:1; |
| 183 | /*! \brief should log messages be prefixed with an extended timestamp? */ |
| 184 | unsigned int print_ext_timestamp:1; |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 185 | |
Harald Welte | 18fc465 | 2011-08-17 14:14:17 +0200 | [diff] [blame] | 186 | /*! \brief the type of this log taget */ |
Harald Welte | 2822296 | 2011-02-18 20:37:04 +0100 | [diff] [blame] | 187 | enum log_target_type type; |
| 188 | |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 189 | union { |
| 190 | struct { |
| 191 | FILE *out; |
Harald Welte | 72d0c53 | 2010-08-25 19:24:00 +0200 | [diff] [blame] | 192 | const char *fname; |
Harald Welte | 0083cd3 | 2010-08-25 14:55:44 +0200 | [diff] [blame] | 193 | } tgt_file; |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 194 | |
| 195 | struct { |
| 196 | int priority; |
Harald Welte | 2822296 | 2011-02-18 20:37:04 +0100 | [diff] [blame] | 197 | int facility; |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 198 | } tgt_syslog; |
| 199 | |
| 200 | struct { |
| 201 | void *vty; |
| 202 | } tgt_vty; |
Katerina Barone-Adesi | 3309a43 | 2013-02-21 05:16:29 +0000 | [diff] [blame] | 203 | |
| 204 | struct { |
| 205 | void *rb; |
| 206 | } tgt_rb; |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 207 | }; |
| 208 | |
Harald Welte | 18fc465 | 2011-08-17 14:14:17 +0200 | [diff] [blame] | 209 | /*! \brief call-back function to be called when the logging framework |
| 210 | * wants to log somethnig. |
Katerina Barone-Adesi | c28c6a0 | 2013-02-15 13:27:59 +0100 | [diff] [blame] | 211 | * \param[in] target logging target |
Harald Welte | 18fc465 | 2011-08-17 14:14:17 +0200 | [diff] [blame] | 212 | * \param[in] level log level of currnet message |
| 213 | * \param[in] string the string that is to be written to the log |
| 214 | */ |
Harald Welte | 76e72ab | 2011-02-17 15:52:39 +0100 | [diff] [blame] | 215 | void (*output) (struct log_target *target, unsigned int level, |
| 216 | const char *string); |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 217 | }; |
| 218 | |
| 219 | /* use the above macros */ |
Andreas Eversberg | 2d6563b | 2012-07-10 13:10:15 +0200 | [diff] [blame] | 220 | void logp2(int subsys, unsigned int level, const char *file, |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 221 | int line, int cont, const char *format, ...) |
| 222 | __attribute__ ((format (printf, 6, 7))); |
Harald Welte | b43bc04 | 2011-06-27 10:29:17 +0200 | [diff] [blame] | 223 | int log_init(const struct log_info *inf, void *talloc_ctx); |
Harald Welte | 69e6c3c | 2016-04-20 10:41:27 +0200 | [diff] [blame] | 224 | void log_fini(void); |
Jacob Erlbeck | de6dd72 | 2015-11-17 11:52:24 +0100 | [diff] [blame] | 225 | int log_check_level(int subsys, unsigned int level); |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 226 | |
| 227 | /* context management */ |
| 228 | void log_reset_context(void); |
| 229 | int log_set_context(uint8_t ctx, void *value); |
| 230 | |
| 231 | /* filter on the targets */ |
| 232 | void log_set_all_filter(struct log_target *target, int); |
| 233 | |
| 234 | void log_set_use_color(struct log_target *target, int); |
Holger Hans Peter Freyther | 2d6ad13 | 2014-12-05 09:35:30 +0100 | [diff] [blame] | 235 | void log_set_print_extended_timestamp(struct log_target *target, int); |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 236 | void log_set_print_timestamp(struct log_target *target, int); |
Holger Hans Peter Freyther | db15336 | 2012-09-11 11:24:51 +0200 | [diff] [blame] | 237 | void log_set_print_filename(struct log_target *target, int); |
Holger Hans Peter Freyther | 2d6ad13 | 2014-12-05 09:35:30 +0100 | [diff] [blame] | 238 | void log_set_print_category(struct log_target *target, int); |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 239 | void log_set_log_level(struct log_target *target, int log_level); |
| 240 | void log_parse_category_mask(struct log_target *target, const char* mask); |
| 241 | int log_parse_level(const char *lvl); |
Harald Welte | 9ac2225 | 2010-05-11 11:19:40 +0200 | [diff] [blame] | 242 | const char *log_level_str(unsigned int lvl); |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 243 | int log_parse_category(const char *category); |
| 244 | void log_set_category_filter(struct log_target *target, int category, |
| 245 | int enable, int level); |
| 246 | |
| 247 | /* management of the targets */ |
| 248 | struct log_target *log_target_create(void); |
Harald Welte | 72d0c53 | 2010-08-25 19:24:00 +0200 | [diff] [blame] | 249 | void log_target_destroy(struct log_target *target); |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 250 | struct log_target *log_target_create_stderr(void); |
Harald Welte | 72d0c53 | 2010-08-25 19:24:00 +0200 | [diff] [blame] | 251 | struct log_target *log_target_create_file(const char *fname); |
Harald Welte | 46cfd77 | 2011-02-17 15:56:56 +0100 | [diff] [blame] | 252 | struct log_target *log_target_create_syslog(const char *ident, int option, |
| 253 | int facility); |
Harald Welte | 72d0c53 | 2010-08-25 19:24:00 +0200 | [diff] [blame] | 254 | int log_target_file_reopen(struct log_target *tgt); |
Harald Welte | 4de854d | 2013-03-18 19:01:40 +0100 | [diff] [blame] | 255 | int log_targets_reopen(void); |
Harald Welte | 72d0c53 | 2010-08-25 19:24:00 +0200 | [diff] [blame] | 256 | |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 257 | void log_add_target(struct log_target *target); |
| 258 | void log_del_target(struct log_target *target); |
| 259 | |
Pablo Neira Ayuso | 04139f1 | 2011-03-09 13:05:08 +0100 | [diff] [blame] | 260 | /* Generate command string for VTY use */ |
| 261 | const char *log_vty_command_string(const struct log_info *info); |
| 262 | const char *log_vty_command_description(const struct log_info *info); |
Harald Welte | 7638af9 | 2010-05-11 16:39:22 +0200 | [diff] [blame] | 263 | |
Harald Welte | 2822296 | 2011-02-18 20:37:04 +0100 | [diff] [blame] | 264 | struct log_target *log_target_find(int type, const char *fname); |
| 265 | extern struct llist_head osmo_log_target_list; |
| 266 | |
Sylvain Munaut | dca7d2c | 2012-04-18 21:53:23 +0200 | [diff] [blame] | 267 | /*! @} */ |