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 | * @{ |
Neels Hofmeyr | 17518fe | 2017-06-20 04:35:06 +0200 | [diff] [blame] | 5 | * \file logging.h */ |
Harald Welte | 18fc465 | 2011-08-17 14:14:17 +0200 | [diff] [blame] | 6 | |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 7 | #include <stdio.h> |
| 8 | #include <stdint.h> |
Christoph Fritz | ab7c9c7 | 2011-09-01 16:22:17 +0200 | [diff] [blame] | 9 | #include <stdarg.h> |
Harald Welte | aa00f99 | 2016-12-02 15:30:02 +0100 | [diff] [blame] | 10 | #include <stdbool.h> |
Max | aa1bc01 | 2017-01-13 11:01:12 +0100 | [diff] [blame] | 11 | #include <osmocom/core/defs.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 | |
Philipp Maier | 4c44d46 | 2022-01-19 11:43:05 +0100 | [diff] [blame] | 14 | extern struct log_info *osmo_log_info; |
| 15 | |
Kévin Redon | d1e220f | 2019-06-13 13:41:00 +0200 | [diff] [blame] | 16 | #ifndef DEBUG |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 17 | #define DEBUG |
Kévin Redon | d1e220f | 2019-06-13 13:41:00 +0200 | [diff] [blame] | 18 | #endif |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 19 | |
Eric | d02090b | 2021-11-24 20:24:46 +0100 | [diff] [blame] | 20 | #ifdef LIBOSMOCORE_NO_LOGGING |
| 21 | #undef DEBUG |
| 22 | #endif |
| 23 | |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 24 | #ifdef DEBUG |
Neels Hofmeyr | 87e4550 | 2017-06-20 00:17:59 +0200 | [diff] [blame] | 25 | /*! Log a debug message through the Osmocom logging framework |
Harald Welte | 2d2e2cc | 2016-04-25 12:11:20 +0200 | [diff] [blame] | 26 | * \param[in] ss logging subsystem (e.g. \ref DLGLOBAL) |
| 27 | * \param[in] fmt format string |
| 28 | * \param[in] args variable argument list |
| 29 | */ |
Max | aa1bc01 | 2017-01-13 11:01:12 +0100 | [diff] [blame] | 30 | #define DEBUGP(ss, fmt, args...) LOGP(ss, LOGL_DEBUG, fmt, ##args) |
| 31 | #define DEBUGPC(ss, fmt, args...) LOGPC(ss, LOGL_DEBUG, fmt, ##args) |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 32 | #else |
| 33 | #define DEBUGP(xss, fmt, args...) |
| 34 | #define DEBUGPC(ss, fmt, args...) |
| 35 | #endif |
| 36 | |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 37 | |
Holger Hans Peter Freyther | fb4bfc2 | 2012-07-12 09:26:25 +0200 | [diff] [blame] | 38 | void osmo_vlogp(int subsys, int level, const char *file, int line, |
Harald Welte | 36c5a3e | 2011-08-27 14:33:19 +0200 | [diff] [blame] | 39 | int cont, const char *format, va_list ap); |
| 40 | |
Max | aa1bc01 | 2017-01-13 11:01:12 +0100 | [diff] [blame] | 41 | void logp(int subsys, const char *file, int line, int cont, const char *format, ...) OSMO_DEPRECATED("Use DEBUGP* macros instead"); |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 42 | |
Neels Hofmeyr | 87e4550 | 2017-06-20 00:17:59 +0200 | [diff] [blame] | 43 | /*! Log a new message through the Osmocom logging framework |
Harald Welte | bd598e3 | 2011-08-16 23:26:52 +0200 | [diff] [blame] | 44 | * \param[in] ss logging subsystem (e.g. \ref DLGLOBAL) |
| 45 | * \param[in] level logging level (e.g. \ref LOGL_NOTICE) |
| 46 | * \param[in] fmt format string |
| 47 | * \param[in] args variable argument list |
| 48 | */ |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 49 | #define LOGP(ss, level, fmt, args...) \ |
Neels Hofmeyr | 725698a | 2016-12-14 17:24:54 +0100 | [diff] [blame] | 50 | LOGPSRC(ss, level, NULL, 0, fmt, ## args) |
Harald Welte | bd598e3 | 2011-08-16 23:26:52 +0200 | [diff] [blame] | 51 | |
Neels Hofmeyr | 87e4550 | 2017-06-20 00:17:59 +0200 | [diff] [blame] | 52 | /*! Continue a log message through the Osmocom logging framework |
Harald Welte | bd598e3 | 2011-08-16 23:26:52 +0200 | [diff] [blame] | 53 | * \param[in] ss logging subsystem (e.g. \ref DLGLOBAL) |
| 54 | * \param[in] level logging level (e.g. \ref LOGL_NOTICE) |
| 55 | * \param[in] fmt format string |
| 56 | * \param[in] args variable argument list |
| 57 | */ |
Eric Wild | 63e1b2b | 2021-11-26 21:09:01 +0100 | [diff] [blame] | 58 | #ifndef LIBOSMOCORE_NO_LOGGING |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 59 | #define LOGPC(ss, level, fmt, args...) \ |
Jacob Erlbeck | a89d22c | 2015-11-17 11:52:25 +0100 | [diff] [blame] | 60 | do { \ |
Philipp Maier | 4c44d46 | 2022-01-19 11:43:05 +0100 | [diff] [blame] | 61 | if (!osmo_log_info) { \ |
| 62 | logp_stub(__FILE__, __LINE__, 1, fmt, ##args); \ |
| 63 | break; \ |
| 64 | } \ |
Jacob Erlbeck | a89d22c | 2015-11-17 11:52:25 +0100 | [diff] [blame] | 65 | if (log_check_level(ss, level)) \ |
Neels Hofmeyr | 983dcb9 | 2018-08-20 12:33:22 +0200 | [diff] [blame] | 66 | logp2(ss, level, __FILE__, __LINE__, 1, fmt, ##args); \ |
Jacob Erlbeck | a89d22c | 2015-11-17 11:52:25 +0100 | [diff] [blame] | 67 | } while(0) |
Eric Wild | 63e1b2b | 2021-11-26 21:09:01 +0100 | [diff] [blame] | 68 | #else |
| 69 | #define LOGPC(ss, level, fmt, args...) |
| 70 | #endif |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 71 | |
Neels Hofmeyr | 87e4550 | 2017-06-20 00:17:59 +0200 | [diff] [blame] | 72 | /*! Log through the Osmocom logging framework with explicit source. |
Neels Hofmeyr | 983dcb9 | 2018-08-20 12:33:22 +0200 | [diff] [blame] | 73 | * If caller_file is passed as NULL, __FILE__ and __LINE__ are used |
Neels Hofmeyr | 725698a | 2016-12-14 17:24:54 +0100 | [diff] [blame] | 74 | * instead of caller_file and caller_line (so that this macro here defines |
| 75 | * both cases in the same place, and to catch cases where callers fail to pass |
| 76 | * a non-null filename string). |
| 77 | * \param[in] ss logging subsystem (e.g. \ref DLGLOBAL) |
| 78 | * \param[in] level logging level (e.g. \ref LOGL_NOTICE) |
Neels Hofmeyr | 983dcb9 | 2018-08-20 12:33:22 +0200 | [diff] [blame] | 79 | * \param[in] caller_file caller's source file string (e.g. __FILE__) |
Neels Hofmeyr | 725698a | 2016-12-14 17:24:54 +0100 | [diff] [blame] | 80 | * \param[in] caller_line caller's source line nr (e.g. __LINE__) |
| 81 | * \param[in] fmt format string |
| 82 | * \param[in] args variable argument list |
| 83 | */ |
| 84 | #define LOGPSRC(ss, level, caller_file, caller_line, fmt, args...) \ |
Holger Hans Peter Freyther | 37a8340 | 2017-11-29 11:46:39 +0800 | [diff] [blame] | 85 | LOGPSRCC(ss, level, caller_file, caller_line, 0, fmt, ##args) |
| 86 | |
| 87 | /*! Log through the Osmocom logging framework with explicit source. |
Neels Hofmeyr | 983dcb9 | 2018-08-20 12:33:22 +0200 | [diff] [blame] | 88 | * If caller_file is passed as NULL, __FILE__ and __LINE__ are used |
Holger Hans Peter Freyther | 37a8340 | 2017-11-29 11:46:39 +0800 | [diff] [blame] | 89 | * instead of caller_file and caller_line (so that this macro here defines |
| 90 | * both cases in the same place, and to catch cases where callers fail to pass |
| 91 | * a non-null filename string). |
| 92 | * \param[in] ss logging subsystem (e.g. \ref DLGLOBAL) |
| 93 | * \param[in] level logging level (e.g. \ref LOGL_NOTICE) |
Neels Hofmeyr | 983dcb9 | 2018-08-20 12:33:22 +0200 | [diff] [blame] | 94 | * \param[in] caller_file caller's source file string (e.g. __FILE__) |
Holger Hans Peter Freyther | 37a8340 | 2017-11-29 11:46:39 +0800 | [diff] [blame] | 95 | * \param[in] caller_line caller's source line nr (e.g. __LINE__) |
| 96 | * \param[in] cont continuation (1) or new line (0) |
| 97 | * \param[in] fmt format string |
| 98 | * \param[in] args variable argument list |
| 99 | */ |
Eric Wild | 63e1b2b | 2021-11-26 21:09:01 +0100 | [diff] [blame] | 100 | #ifndef LIBOSMOCORE_NO_LOGGING |
Holger Hans Peter Freyther | 37a8340 | 2017-11-29 11:46:39 +0800 | [diff] [blame] | 101 | #define LOGPSRCC(ss, level, caller_file, caller_line, cont, fmt, args...) \ |
Neels Hofmeyr | 725698a | 2016-12-14 17:24:54 +0100 | [diff] [blame] | 102 | do { \ |
Philipp Maier | 4c44d46 | 2022-01-19 11:43:05 +0100 | [diff] [blame] | 103 | if (!osmo_log_info) { \ |
| 104 | if (caller_file) \ |
| 105 | logp_stub(caller_file, caller_line, cont, fmt, ##args); \ |
| 106 | else \ |
| 107 | logp_stub(__FILE__, __LINE__, cont, fmt, ##args); \ |
| 108 | break; \ |
| 109 | } \ |
Neels Hofmeyr | 725698a | 2016-12-14 17:24:54 +0100 | [diff] [blame] | 110 | if (log_check_level(ss, level)) {\ |
| 111 | if (caller_file) \ |
Holger Hans Peter Freyther | 37a8340 | 2017-11-29 11:46:39 +0800 | [diff] [blame] | 112 | logp2(ss, level, caller_file, caller_line, cont, fmt, ##args); \ |
Neels Hofmeyr | 725698a | 2016-12-14 17:24:54 +0100 | [diff] [blame] | 113 | else \ |
Neels Hofmeyr | 983dcb9 | 2018-08-20 12:33:22 +0200 | [diff] [blame] | 114 | logp2(ss, level, __FILE__, __LINE__, cont, fmt, ##args); \ |
Neels Hofmeyr | 725698a | 2016-12-14 17:24:54 +0100 | [diff] [blame] | 115 | }\ |
| 116 | } while(0) |
Eric Wild | 63e1b2b | 2021-11-26 21:09:01 +0100 | [diff] [blame] | 117 | #else |
| 118 | #define LOGPSRCC(ss, level, caller_file, caller_line, cont, fmt, args...) |
| 119 | #endif |
Neels Hofmeyr | 725698a | 2016-12-14 17:24:54 +0100 | [diff] [blame] | 120 | |
Neels Hofmeyr | 87e4550 | 2017-06-20 00:17:59 +0200 | [diff] [blame] | 121 | /*! different log levels */ |
| 122 | #define LOGL_DEBUG 1 /*!< debugging information */ |
| 123 | #define LOGL_INFO 3 /*!< general information */ |
| 124 | #define LOGL_NOTICE 5 /*!< abnormal/unexpected condition */ |
| 125 | #define LOGL_ERROR 7 /*!< error condition, requires user action */ |
| 126 | #define LOGL_FATAL 8 /*!< fatal, program aborted */ |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 127 | |
Neels Hofmeyr | e883de5 | 2019-11-20 04:28:52 +0100 | [diff] [blame] | 128 | /* logging subsystems defined by the library itself */ |
Harald Welte | 2d2e2cc | 2016-04-25 12:11:20 +0200 | [diff] [blame] | 129 | #define DLGLOBAL -1 /*!< global logging */ |
| 130 | #define DLLAPD -2 /*!< LAPD implementation */ |
| 131 | #define DLINP -3 /*!< (A-bis) Input sub-system */ |
| 132 | #define DLMUX -4 /*!< Osmocom Multiplex (Osmux) */ |
| 133 | #define DLMI -5 /*!< ISDN-layer below input sub-system */ |
| 134 | #define DLMIB -6 /*!< ISDN layer B-channel */ |
| 135 | #define DLSMS -7 /*!< SMS sub-system */ |
| 136 | #define DLCTRL -8 /*!< Control Interface */ |
| 137 | #define DLGTP -9 /*!< GTP (GPRS Tunneling Protocol */ |
| 138 | #define DLSTATS -10 /*!< Statistics */ |
Neels Hofmeyr | 9795cf1 | 2016-12-10 17:01:06 +0100 | [diff] [blame] | 139 | #define DLGSUP -11 /*!< Generic Subscriber Update Protocol */ |
Harald Welte | c0f0007 | 2016-04-27 18:32:35 +0200 | [diff] [blame] | 140 | #define DLOAP -12 /*!< Osmocom Authentication Protocol */ |
Harald Welte | 62d3296 | 2017-04-03 19:37:11 +0200 | [diff] [blame] | 141 | #define DLSS7 -13 /*!< Osmocom SS7 */ |
| 142 | #define DLSCCP -14 /*!< Osmocom SCCP */ |
| 143 | #define DLSUA -15 /*!< Osmocom SUA */ |
| 144 | #define DLM3UA -16 /*!< Osmocom M3UA */ |
Neels Hofmeyr | a7ccf61 | 2017-07-11 18:43:09 +0200 | [diff] [blame] | 145 | #define DLMGCP -17 /*!< Osmocom MGCP */ |
Pau Espin Pedrol | 8fd8557 | 2018-02-27 19:43:10 +0100 | [diff] [blame] | 146 | #define DLJIBUF -18 /*!< Osmocom Jitter Buffer */ |
Harald Welte | b99ed7f | 2018-08-13 20:54:44 +0200 | [diff] [blame] | 147 | #define DLRSPRO -19 /*!< Osmocom Remote SIM Protocol */ |
Alexander Couzens | 6a16149 | 2020-07-12 13:45:50 +0200 | [diff] [blame] | 148 | #define DLNS -20 /*!< Osmocom NS layer */ |
Harald Welte | fde19ed | 2020-12-07 21:43:51 +0100 | [diff] [blame] | 149 | #define DLBSSGP -21 /*!< Osmocom BSSGP layer */ |
Alexander Couzens | 6cf65d9 | 2021-01-18 17:55:35 +0100 | [diff] [blame] | 150 | #define DLNSDATA -22 /*!< Osmocom NS layer data pdus */ |
| 151 | #define DLNSSIGNAL -23 /*!< Osmocom NS layer signal pdus */ |
Harald Welte | 9fe1f9f | 2018-11-29 13:47:39 +0100 | [diff] [blame] | 152 | #define DLIUUP -24 /*!< Osmocom IuUP layer */ |
Neels Hofmeyr | 13fa00e | 2021-11-26 11:02:47 +0100 | [diff] [blame] | 153 | #define DLPFCP -25 /*!< Osmocom Packet Forwarding Control Protocol */ |
Vadim Yanitskiy | 8137d9a | 2022-08-03 05:35:04 +0700 | [diff] [blame] | 154 | #define DLCSN1 -26 /*!< CSN.1 (Concrete Syntax Notation 1) codec */ |
Harald Welte | d98a867 | 2022-09-03 14:58:24 +0200 | [diff] [blame] | 155 | #define DLM2PA -27 /*!< Osmocom M2PA (libosmo-sigtran) */ |
| 156 | #define DLM2UA -28 /*!< Reserved for future Osmocom M2UA (libosmo-sigtran) */ |
Harald Welte | 8857f3b | 2022-11-18 13:54:44 +0100 | [diff] [blame] | 157 | #define DLIO -29 /*!< Osmocom IO sub-system */ |
| 158 | #define OSMO_NUM_DLIB 29 /*!< Number of logging sub-systems in libraries */ |
Harald Welte | b43bc04 | 2011-06-27 10:29:17 +0200 | [diff] [blame] | 159 | |
Neels Hofmeyr | f2644ae | 2019-11-20 04:00:29 +0100 | [diff] [blame] | 160 | /* Colors that can be used in log_info_cat.color */ |
| 161 | #define OSMO_LOGCOLOR_NORMAL NULL |
| 162 | #define OSMO_LOGCOLOR_RED "\033[1;31m" |
| 163 | #define OSMO_LOGCOLOR_GREEN "\033[1;32m" |
| 164 | #define OSMO_LOGCOLOR_YELLOW "\033[1;33m" |
| 165 | #define OSMO_LOGCOLOR_BLUE "\033[1;34m" |
| 166 | #define OSMO_LOGCOLOR_PURPLE "\033[1;35m" |
| 167 | #define OSMO_LOGCOLOR_CYAN "\033[1;36m" |
| 168 | #define OSMO_LOGCOLOR_DARKRED "\033[31m" |
| 169 | #define OSMO_LOGCOLOR_DARKGREEN "\033[32m" |
| 170 | #define OSMO_LOGCOLOR_DARKYELLOW "\033[33m" |
| 171 | #define OSMO_LOGCOLOR_DARKBLUE "\033[34m" |
| 172 | #define OSMO_LOGCOLOR_DARKPURPLE "\033[35m" |
| 173 | #define OSMO_LOGCOLOR_DARKCYAN "\033[36m" |
| 174 | #define OSMO_LOGCOLOR_DARKGREY "\033[1;30m" |
| 175 | #define OSMO_LOGCOLOR_GREY "\033[37m" |
| 176 | #define OSMO_LOGCOLOR_BRIGHTWHITE "\033[1;37m" |
| 177 | #define OSMO_LOGCOLOR_END "\033[0;m" |
| 178 | |
Neels Hofmeyr | fc47b03 | 2017-06-20 04:29:38 +0200 | [diff] [blame] | 179 | /*! Configuration of single log category / sub-system */ |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 180 | struct log_category { |
Harald Welte | 2d2e2cc | 2016-04-25 12:11:20 +0200 | [diff] [blame] | 181 | uint8_t loglevel; /*!< configured log-level */ |
| 182 | uint8_t enabled; /*!< is logging enabled? */ |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 183 | }; |
| 184 | |
Neels Hofmeyr | 87e4550 | 2017-06-20 00:17:59 +0200 | [diff] [blame] | 185 | /*! Information regarding one logging category */ |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 186 | struct log_info_cat { |
Harald Welte | 18fc465 | 2011-08-17 14:14:17 +0200 | [diff] [blame] | 187 | const char *name; /*!< name of category */ |
| 188 | const char *color; /*!< color string for cateyory */ |
| 189 | const char *description; /*!< description text */ |
| 190 | uint8_t loglevel; /*!< currently selected log-level */ |
| 191 | uint8_t enabled; /*!< is this category enabled or not */ |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 192 | }; |
| 193 | |
Neels Hofmeyr | 87e4550 | 2017-06-20 00:17:59 +0200 | [diff] [blame] | 194 | /*! Indexes to indicate the object currently acted upon. |
Neels Hofmeyr | 492e180 | 2017-02-23 17:45:26 +0100 | [diff] [blame] | 195 | * Array indexes for the global \a log_context array. */ |
Neels Hofmeyr | 8b86cd7 | 2017-02-23 18:03:28 +0100 | [diff] [blame] | 196 | enum log_ctx_index { |
| 197 | LOG_CTX_GB_NSVC, |
| 198 | LOG_CTX_GB_BVC, |
| 199 | LOG_CTX_BSC_SUBSCR, |
| 200 | LOG_CTX_VLR_SUBSCR, |
Oliver Smith | 210acc6 | 2019-09-12 17:13:34 +0200 | [diff] [blame] | 201 | LOG_CTX_L1_SAPI, |
Daniel Willmann | 751977b | 2020-12-02 18:59:44 +0100 | [diff] [blame] | 202 | LOG_CTX_GB_NSE, |
Neels Hofmeyr | 8b86cd7 | 2017-02-23 18:03:28 +0100 | [diff] [blame] | 203 | _LOG_CTX_COUNT |
Neels Hofmeyr | 812ba6d | 2017-02-17 16:35:27 +0100 | [diff] [blame] | 204 | }; |
| 205 | |
Neels Hofmeyr | 87e4550 | 2017-06-20 00:17:59 +0200 | [diff] [blame] | 206 | /*! Indexes to indicate objects that should be logged. |
Neels Hofmeyr | 492e180 | 2017-02-23 17:45:26 +0100 | [diff] [blame] | 207 | * Array indexes to log_target->filter_data and bit indexes for |
| 208 | * log_target->filter_map. */ |
Neels Hofmeyr | 8b86cd7 | 2017-02-23 18:03:28 +0100 | [diff] [blame] | 209 | enum log_filter_index { |
| 210 | LOG_FLT_ALL, |
| 211 | LOG_FLT_GB_NSVC, |
| 212 | LOG_FLT_GB_BVC, |
| 213 | LOG_FLT_BSC_SUBSCR, |
| 214 | LOG_FLT_VLR_SUBSCR, |
Oliver Smith | 210acc6 | 2019-09-12 17:13:34 +0200 | [diff] [blame] | 215 | LOG_FLT_L1_SAPI, |
Daniel Willmann | 751977b | 2020-12-02 18:59:44 +0100 | [diff] [blame] | 216 | LOG_FLT_GB_NSE, |
Neels Hofmeyr | 8b86cd7 | 2017-02-23 18:03:28 +0100 | [diff] [blame] | 217 | _LOG_FLT_COUNT |
Neels Hofmeyr | 812ba6d | 2017-02-17 16:35:27 +0100 | [diff] [blame] | 218 | }; |
| 219 | |
Daniel Willmann | fd3478c | 2020-12-02 18:14:17 +0100 | [diff] [blame] | 220 | /*! Maximum number of logging contexts */ |
| 221 | #define LOG_MAX_CTX _LOG_CTX_COUNT |
| 222 | /*! Maximum number of logging filters */ |
| 223 | #define LOG_MAX_FILTERS _LOG_FLT_COUNT |
| 224 | |
| 225 | /*! Log context information, passed to filter */ |
| 226 | struct log_context { |
| 227 | void *ctx[LOG_MAX_CTX+1]; |
| 228 | }; |
| 229 | |
Neels Hofmeyr | 87e4550 | 2017-06-20 00:17:59 +0200 | [diff] [blame] | 230 | /*! Compatibility with older libosmocore versions */ |
Neels Hofmeyr | 8b86cd7 | 2017-02-23 18:03:28 +0100 | [diff] [blame] | 231 | #define LOG_FILTER_ALL (1<<LOG_FLT_ALL) |
Neels Hofmeyr | 87e4550 | 2017-06-20 00:17:59 +0200 | [diff] [blame] | 232 | /*! Compatibility with older libosmocore versions */ |
Neels Hofmeyr | 8b86cd7 | 2017-02-23 18:03:28 +0100 | [diff] [blame] | 233 | #define GPRS_CTX_NSVC LOG_CTX_GB_NSVC |
Neels Hofmeyr | 87e4550 | 2017-06-20 00:17:59 +0200 | [diff] [blame] | 234 | /*! Compatibility with older libosmocore versions */ |
Neels Hofmeyr | 8b86cd7 | 2017-02-23 18:03:28 +0100 | [diff] [blame] | 235 | #define GPRS_CTX_BVC LOG_CTX_GB_BVC |
Neels Hofmeyr | 87e4550 | 2017-06-20 00:17:59 +0200 | [diff] [blame] | 236 | /*! Indexes to indicate the object currently acted upon. |
Neels Hofmeyr | 8b86cd7 | 2017-02-23 18:03:28 +0100 | [diff] [blame] | 237 | * Array indexes for the global \a log_context array. */ |
Neels Hofmeyr | 0d6420b | 2017-02-23 17:34:35 +0100 | [diff] [blame] | 238 | |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 239 | struct log_target; |
| 240 | |
Neels Hofmeyr | 87e4550 | 2017-06-20 00:17:59 +0200 | [diff] [blame] | 241 | /*! Log filter function */ |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 242 | typedef int log_filter(const struct log_context *ctx, |
| 243 | struct log_target *target); |
| 244 | |
Harald Welte | fb84f32 | 2013-06-06 07:33:54 +0200 | [diff] [blame] | 245 | struct log_info; |
| 246 | struct vty; |
Harald Welte | aa00f99 | 2016-12-02 15:30:02 +0100 | [diff] [blame] | 247 | struct gsmtap_inst; |
Harald Welte | fb84f32 | 2013-06-06 07:33:54 +0200 | [diff] [blame] | 248 | |
| 249 | typedef void log_print_filters(struct vty *vty, |
| 250 | const struct log_info *info, |
| 251 | const struct log_target *tgt); |
| 252 | |
| 253 | typedef void log_save_filters(struct vty *vty, |
| 254 | const struct log_info *info, |
| 255 | const struct log_target *tgt); |
| 256 | |
Neels Hofmeyr | 87e4550 | 2017-06-20 00:17:59 +0200 | [diff] [blame] | 257 | /*! Logging configuration, passed to \ref log_init */ |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 258 | struct log_info { |
Neels Hofmeyr | 87e4550 | 2017-06-20 00:17:59 +0200 | [diff] [blame] | 259 | /* filter callback function */ |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 260 | log_filter *filter_fn; |
| 261 | |
Neels Hofmeyr | 87e4550 | 2017-06-20 00:17:59 +0200 | [diff] [blame] | 262 | /*! per-category information */ |
Holger Hans Peter Freyther | 06f6455 | 2012-09-11 10:31:29 +0200 | [diff] [blame] | 263 | const struct log_info_cat *cat; |
Neels Hofmeyr | 87e4550 | 2017-06-20 00:17:59 +0200 | [diff] [blame] | 264 | /*! total number of categories */ |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 265 | unsigned int num_cat; |
Neels Hofmeyr | 87e4550 | 2017-06-20 00:17:59 +0200 | [diff] [blame] | 266 | /*! total number of user categories (not library) */ |
Harald Welte | b43bc04 | 2011-06-27 10:29:17 +0200 | [diff] [blame] | 267 | unsigned int num_cat_user; |
Harald Welte | fb84f32 | 2013-06-06 07:33:54 +0200 | [diff] [blame] | 268 | |
Neels Hofmeyr | 87e4550 | 2017-06-20 00:17:59 +0200 | [diff] [blame] | 269 | /*! filter saving function */ |
Harald Welte | fb84f32 | 2013-06-06 07:33:54 +0200 | [diff] [blame] | 270 | log_save_filters *save_fn; |
Neels Hofmeyr | 87e4550 | 2017-06-20 00:17:59 +0200 | [diff] [blame] | 271 | /*! filter saving function */ |
Harald Welte | fb84f32 | 2013-06-06 07:33:54 +0200 | [diff] [blame] | 272 | log_print_filters *print_fn; |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 273 | }; |
| 274 | |
Neels Hofmeyr | 87e4550 | 2017-06-20 00:17:59 +0200 | [diff] [blame] | 275 | /*! Type of logging target */ |
Harald Welte | 2822296 | 2011-02-18 20:37:04 +0100 | [diff] [blame] | 276 | enum log_target_type { |
Neels Hofmeyr | 87e4550 | 2017-06-20 00:17:59 +0200 | [diff] [blame] | 277 | LOG_TGT_TYPE_VTY, /*!< VTY logging */ |
| 278 | LOG_TGT_TYPE_SYSLOG, /*!< syslog based logging */ |
| 279 | LOG_TGT_TYPE_FILE, /*!< text file logging */ |
| 280 | LOG_TGT_TYPE_STDERR, /*!< stderr logging */ |
| 281 | LOG_TGT_TYPE_STRRB, /*!< osmo_strrb-backed logging */ |
| 282 | LOG_TGT_TYPE_GSMTAP, /*!< GSMTAP network logging */ |
Vadim Yanitskiy | e7bf435 | 2020-09-09 03:36:48 +0700 | [diff] [blame] | 283 | LOG_TGT_TYPE_SYSTEMD, /*!< systemd journal logging */ |
Harald Welte | 2822296 | 2011-02-18 20:37:04 +0100 | [diff] [blame] | 284 | }; |
| 285 | |
Neels Hofmeyr | bd7bd39 | 2018-01-16 01:52:29 +0100 | [diff] [blame] | 286 | /*! Whether/how to log the source filename (and line number). */ |
| 287 | enum log_filename_type { |
| 288 | LOG_FILENAME_NONE, |
| 289 | LOG_FILENAME_PATH, |
Neels Hofmeyr | 0e2a943 | 2018-01-16 02:49:48 +0100 | [diff] [blame] | 290 | LOG_FILENAME_BASENAME, |
Neels Hofmeyr | bd7bd39 | 2018-01-16 01:52:29 +0100 | [diff] [blame] | 291 | }; |
| 292 | |
Neels Hofmeyr | 77ae45d | 2018-08-27 20:32:36 +0200 | [diff] [blame] | 293 | /*! Where on a log line source file and line should be logged. */ |
| 294 | enum log_filename_pos { |
| 295 | LOG_FILENAME_POS_HEADER_END, |
| 296 | LOG_FILENAME_POS_LINE_END, |
| 297 | }; |
| 298 | |
Neels Hofmeyr | 87e4550 | 2017-06-20 00:17:59 +0200 | [diff] [blame] | 299 | /*! structure representing a logging target */ |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 300 | struct log_target { |
Pau Espin Pedrol | 9d3cfef | 2022-04-27 17:42:26 +0200 | [diff] [blame] | 301 | struct llist_head entry; /*!< linked list */ |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 302 | |
Neels Hofmeyr | 87e4550 | 2017-06-20 00:17:59 +0200 | [diff] [blame] | 303 | /*! Internal data for filtering */ |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 304 | int filter_map; |
Neels Hofmeyr | 87e4550 | 2017-06-20 00:17:59 +0200 | [diff] [blame] | 305 | /*! Internal data for filtering */ |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 306 | void *filter_data[LOG_MAX_FILTERS+1]; |
| 307 | |
Neels Hofmeyr | 87e4550 | 2017-06-20 00:17:59 +0200 | [diff] [blame] | 308 | /*! logging categories */ |
Harald Welte | b43bc04 | 2011-06-27 10:29:17 +0200 | [diff] [blame] | 309 | struct log_category *categories; |
| 310 | |
Neels Hofmeyr | 87e4550 | 2017-06-20 00:17:59 +0200 | [diff] [blame] | 311 | /*! global log level */ |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 312 | uint8_t loglevel; |
Neels Hofmeyr | 87e4550 | 2017-06-20 00:17:59 +0200 | [diff] [blame] | 313 | /*! should color be used when printing log messages? */ |
Harald Welte | 87dbca1 | 2011-07-16 11:57:53 +0200 | [diff] [blame] | 314 | unsigned int use_color:1; |
Neels Hofmeyr | 87e4550 | 2017-06-20 00:17:59 +0200 | [diff] [blame] | 315 | /*! should log messages be prefixed with a timestamp? */ |
Harald Welte | 87dbca1 | 2011-07-16 11:57:53 +0200 | [diff] [blame] | 316 | unsigned int print_timestamp:1; |
Pau Espin Pedrol | 662d10d | 2021-02-18 18:19:23 +0100 | [diff] [blame] | 317 | /*! should log messages be prefixed with the logger Thread ID? */ |
| 318 | unsigned int print_tid:1; |
Neels Hofmeyr | bd7bd39 | 2018-01-16 01:52:29 +0100 | [diff] [blame] | 319 | /*! DEPRECATED: use print_filename2 instead. */ |
Holger Hans Peter Freyther | db15336 | 2012-09-11 11:24:51 +0200 | [diff] [blame] | 320 | unsigned int print_filename:1; |
Neels Hofmeyr | 87e4550 | 2017-06-20 00:17:59 +0200 | [diff] [blame] | 321 | /*! should log messages be prefixed with a category name? */ |
Holger Hans Peter Freyther | 2d6ad13 | 2014-12-05 09:35:30 +0100 | [diff] [blame] | 322 | unsigned int print_category:1; |
Neels Hofmeyr | 87e4550 | 2017-06-20 00:17:59 +0200 | [diff] [blame] | 323 | /*! should log messages be prefixed with an extended timestamp? */ |
Holger Hans Peter Freyther | 2d6ad13 | 2014-12-05 09:35:30 +0100 | [diff] [blame] | 324 | unsigned int print_ext_timestamp:1; |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 325 | |
Neels Hofmeyr | 87e4550 | 2017-06-20 00:17:59 +0200 | [diff] [blame] | 326 | /*! the type of this log taget */ |
Harald Welte | 2822296 | 2011-02-18 20:37:04 +0100 | [diff] [blame] | 327 | enum log_target_type type; |
| 328 | |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 329 | union { |
| 330 | struct { |
Harald Welte | b72867f | 2020-09-26 21:45:16 +0200 | [diff] [blame] | 331 | /* direct, blocking output via stdio */ |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 332 | FILE *out; |
Harald Welte | 72d0c53 | 2010-08-25 19:24:00 +0200 | [diff] [blame] | 333 | const char *fname; |
Harald Welte | b72867f | 2020-09-26 21:45:16 +0200 | [diff] [blame] | 334 | /* indirect output via write_queue and osmo_select_main() */ |
| 335 | struct osmo_wqueue *wqueue; |
Harald Welte | 0083cd3 | 2010-08-25 14:55:44 +0200 | [diff] [blame] | 336 | } tgt_file; |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 337 | |
| 338 | struct { |
| 339 | int priority; |
Harald Welte | 2822296 | 2011-02-18 20:37:04 +0100 | [diff] [blame] | 340 | int facility; |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 341 | } tgt_syslog; |
| 342 | |
| 343 | struct { |
| 344 | void *vty; |
| 345 | } tgt_vty; |
Katerina Barone-Adesi | 3309a43 | 2013-02-21 05:16:29 +0000 | [diff] [blame] | 346 | |
| 347 | struct { |
| 348 | void *rb; |
| 349 | } tgt_rb; |
Harald Welte | aa00f99 | 2016-12-02 15:30:02 +0100 | [diff] [blame] | 350 | |
| 351 | struct { |
| 352 | struct gsmtap_inst *gsmtap_inst; |
| 353 | const char *ident; |
| 354 | const char *hostname; |
| 355 | } tgt_gsmtap; |
Vadim Yanitskiy | e7bf435 | 2020-09-09 03:36:48 +0700 | [diff] [blame] | 356 | |
| 357 | struct { |
| 358 | bool raw; |
| 359 | } sd_journal; |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 360 | }; |
| 361 | |
Neels Hofmeyr | 87e4550 | 2017-06-20 00:17:59 +0200 | [diff] [blame] | 362 | /*! call-back function to be called when the logging framework |
Harald Welte | d7c0a37 | 2016-12-02 13:52:59 +0100 | [diff] [blame] | 363 | * wants to log a fully formatted string |
Katerina Barone-Adesi | c28c6a0 | 2013-02-15 13:27:59 +0100 | [diff] [blame] | 364 | * \param[in] target logging target |
Harald Welte | 18fc465 | 2011-08-17 14:14:17 +0200 | [diff] [blame] | 365 | * \param[in] level log level of currnet message |
| 366 | * \param[in] string the string that is to be written to the log |
| 367 | */ |
Harald Welte | 76e72ab | 2011-02-17 15:52:39 +0100 | [diff] [blame] | 368 | void (*output) (struct log_target *target, unsigned int level, |
| 369 | const char *string); |
Harald Welte | d7c0a37 | 2016-12-02 13:52:59 +0100 | [diff] [blame] | 370 | |
Neels Hofmeyr | 87e4550 | 2017-06-20 00:17:59 +0200 | [diff] [blame] | 371 | /*! alternative call-back function to which the logging |
Harald Welte | d7c0a37 | 2016-12-02 13:52:59 +0100 | [diff] [blame] | 372 | * framework passes the unfortmatted input arguments, |
| 373 | * i.e. bypassing the internal string formatter |
| 374 | * \param[in] target logging target |
| 375 | * \param[in] subsys logging sub-system |
| 376 | * \param[in] level logging level |
| 377 | * \param[in] file soure code file name |
| 378 | * \param[in] line source code file line number |
| 379 | * \param[in] cont continuation of previous statement? |
| 380 | * \param[in] format format string |
| 381 | * \param[in] ap vararg list of printf arguments |
| 382 | */ |
| 383 | void (*raw_output)(struct log_target *target, int subsys, |
| 384 | unsigned int level, const char *file, int line, |
| 385 | int cont, const char *format, va_list ap); |
Neels Hofmeyr | 886e548 | 2018-01-16 01:49:37 +0100 | [diff] [blame] | 386 | |
| 387 | /* Should the log level be printed? */ |
| 388 | bool print_level; |
Neels Hofmeyr | bd7bd39 | 2018-01-16 01:52:29 +0100 | [diff] [blame] | 389 | /* Should we print the subsys in hex like '<000b>'? */ |
| 390 | bool print_category_hex; |
| 391 | /* Should we print the source file and line, and in which way? */ |
| 392 | enum log_filename_type print_filename2; |
Neels Hofmeyr | 77ae45d | 2018-08-27 20:32:36 +0200 | [diff] [blame] | 393 | /* Where on a log line to put the source file info. */ |
| 394 | enum log_filename_pos print_filename_pos; |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 395 | }; |
| 396 | |
| 397 | /* use the above macros */ |
Andreas Eversberg | 2d6563b | 2012-07-10 13:10:15 +0200 | [diff] [blame] | 398 | void logp2(int subsys, unsigned int level, const char *file, |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 399 | int line, int cont, const char *format, ...) |
| 400 | __attribute__ ((format (printf, 6, 7))); |
Philipp Maier | 4c44d46 | 2022-01-19 11:43:05 +0100 | [diff] [blame] | 401 | void logp_stub(const char *file, int line, int cont, const char *format, ...); |
Harald Welte | b43bc04 | 2011-06-27 10:29:17 +0200 | [diff] [blame] | 402 | int log_init(const struct log_info *inf, void *talloc_ctx); |
Harald Welte | 69e6c3c | 2016-04-20 10:41:27 +0200 | [diff] [blame] | 403 | void log_fini(void); |
Jacob Erlbeck | de6dd72 | 2015-11-17 11:52:24 +0100 | [diff] [blame] | 404 | int log_check_level(int subsys, unsigned int level); |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 405 | |
| 406 | /* context management */ |
| 407 | void log_reset_context(void); |
| 408 | int log_set_context(uint8_t ctx, void *value); |
| 409 | |
| 410 | /* filter on the targets */ |
| 411 | void log_set_all_filter(struct log_target *target, int); |
| 412 | |
| 413 | void log_set_use_color(struct log_target *target, int); |
Holger Hans Peter Freyther | 2d6ad13 | 2014-12-05 09:35:30 +0100 | [diff] [blame] | 414 | void log_set_print_extended_timestamp(struct log_target *target, int); |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 415 | void log_set_print_timestamp(struct log_target *target, int); |
Pau Espin Pedrol | 662d10d | 2021-02-18 18:19:23 +0100 | [diff] [blame] | 416 | void log_set_print_tid(struct log_target *target, int); |
Pau Espin Pedrol | 6e9dd02 | 2021-02-18 19:27:38 +0100 | [diff] [blame] | 417 | void log_set_print_filename(struct log_target *target, int) OSMO_DEPRECATED("Use log_set_print_filename2() instead"); |
Neels Hofmeyr | bd7bd39 | 2018-01-16 01:52:29 +0100 | [diff] [blame] | 418 | void log_set_print_filename2(struct log_target *target, enum log_filename_type lft); |
Neels Hofmeyr | 77ae45d | 2018-08-27 20:32:36 +0200 | [diff] [blame] | 419 | void log_set_print_filename_pos(struct log_target *target, enum log_filename_pos pos); |
Holger Hans Peter Freyther | 2d6ad13 | 2014-12-05 09:35:30 +0100 | [diff] [blame] | 420 | void log_set_print_category(struct log_target *target, int); |
Neels Hofmeyr | bd7bd39 | 2018-01-16 01:52:29 +0100 | [diff] [blame] | 421 | void log_set_print_category_hex(struct log_target *target, int); |
Neels Hofmeyr | 886e548 | 2018-01-16 01:49:37 +0100 | [diff] [blame] | 422 | void log_set_print_level(struct log_target *target, int); |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 423 | void log_set_log_level(struct log_target *target, int log_level); |
| 424 | void log_parse_category_mask(struct log_target *target, const char* mask); |
Harald Welte | aa00f99 | 2016-12-02 15:30:02 +0100 | [diff] [blame] | 425 | const char* log_category_name(int subsys); |
Max | 15b6d41 | 2017-07-06 16:57:15 +0200 | [diff] [blame] | 426 | int log_parse_level(const char *lvl) OSMO_DEPRECATED_OUTSIDE_LIBOSMOCORE; |
| 427 | const char *log_level_str(unsigned int lvl) OSMO_DEPRECATED_OUTSIDE_LIBOSMOCORE; |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 428 | int log_parse_category(const char *category); |
| 429 | void log_set_category_filter(struct log_target *target, int category, |
| 430 | int enable, int level); |
| 431 | |
| 432 | /* management of the targets */ |
| 433 | struct log_target *log_target_create(void); |
Harald Welte | 72d0c53 | 2010-08-25 19:24:00 +0200 | [diff] [blame] | 434 | void log_target_destroy(struct log_target *target); |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 435 | struct log_target *log_target_create_stderr(void); |
Harald Welte | 72d0c53 | 2010-08-25 19:24:00 +0200 | [diff] [blame] | 436 | struct log_target *log_target_create_file(const char *fname); |
Harald Welte | 46cfd77 | 2011-02-17 15:56:56 +0100 | [diff] [blame] | 437 | struct log_target *log_target_create_syslog(const char *ident, int option, |
| 438 | int facility); |
Harald Welte | aa00f99 | 2016-12-02 15:30:02 +0100 | [diff] [blame] | 439 | struct log_target *log_target_create_gsmtap(const char *host, uint16_t port, |
| 440 | const char *ident, |
| 441 | bool ofd_wq_mode, |
| 442 | bool add_sink); |
Vadim Yanitskiy | e7bf435 | 2020-09-09 03:36:48 +0700 | [diff] [blame] | 443 | struct log_target *log_target_create_systemd(bool raw); |
| 444 | void log_target_systemd_set_raw(struct log_target *target, bool raw); |
Harald Welte | 72d0c53 | 2010-08-25 19:24:00 +0200 | [diff] [blame] | 445 | int log_target_file_reopen(struct log_target *tgt); |
Harald Welte | b72867f | 2020-09-26 21:45:16 +0200 | [diff] [blame] | 446 | int log_target_file_switch_to_stream(struct log_target *tgt); |
| 447 | int log_target_file_switch_to_wqueue(struct log_target *tgt); |
Harald Welte | 4de854d | 2013-03-18 19:01:40 +0100 | [diff] [blame] | 448 | int log_targets_reopen(void); |
Harald Welte | 72d0c53 | 2010-08-25 19:24:00 +0200 | [diff] [blame] | 449 | |
Harald Welte | 3ae2758 | 2010-03-26 21:24:24 +0800 | [diff] [blame] | 450 | void log_add_target(struct log_target *target); |
| 451 | void log_del_target(struct log_target *target); |
| 452 | |
Harald Welte | e6fb890 | 2022-01-09 12:00:03 +0100 | [diff] [blame] | 453 | struct log_target *log_target_find(enum log_target_type type, const char *fname); |
Harald Welte | 2822296 | 2011-02-18 20:37:04 +0100 | [diff] [blame] | 454 | |
Pau Espin Pedrol | d12f698 | 2019-09-17 18:38:58 +0200 | [diff] [blame] | 455 | void log_enable_multithread(void); |
| 456 | |
| 457 | void log_tgt_mutex_lock_impl(void); |
| 458 | void log_tgt_mutex_unlock_impl(void); |
| 459 | #define LOG_MTX_DEBUG 0 |
| 460 | #if LOG_MTX_DEBUG |
| 461 | #include <pthread.h> |
| 462 | #define log_tgt_mutex_lock() do { fprintf(stderr, "[%lu] %s:%d [%s] lock\n", pthread_self(), __FILE__, __LINE__, __func__); log_tgt_mutex_lock_impl(); } while (0) |
| 463 | #define log_tgt_mutex_unlock() do { fprintf(stderr, "[%lu] %s:%d [%s] unlock\n", pthread_self(), __FILE__, __LINE__, __func__); log_tgt_mutex_unlock_impl(); } while (0) |
| 464 | #else |
| 465 | #define log_tgt_mutex_lock() log_tgt_mutex_lock_impl() |
| 466 | #define log_tgt_mutex_unlock() log_tgt_mutex_unlock_impl() |
| 467 | #endif |
| 468 | |
Sylvain Munaut | dca7d2c | 2012-04-18 21:53:23 +0200 | [diff] [blame] | 469 | /*! @} */ |