The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Loading...
Searching...
No Matches
log.h
Go to the documentation of this file.
1#pragma once
2/*
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
16 */
17
18/**
19 * $Id: f39be8007fba9f919edfb6e060c60cbd8acd0773 $
20 *
21 * @file lib/server/log.h
22 * @brief Macros and function definitions to write log messages, and control the logging system.
23 *
24 * @copyright 2015 Arran Cudbard-Bell (a.cudbardb@freeradius.org)
25 * @copyright 2013 Alan DeKok (aland@freeradius.org)
26 */
27RCSIDH(server_log_h, "$Id: f39be8007fba9f919edfb6e060c60cbd8acd0773 $")
28
29/*
30 * Forward declarations
31 */
32#ifdef __cplusplus
33extern "C" {
34#endif
35
36/** A logging destination, consisting of a function and its context
37 *
38 */
39typedef struct log_dst log_dst_t;
40typedef struct rindent_s {
41 uint8_t unlang; //!< By how much to indent log messages. uin8_t so it's obvious
42 //!< when a request has been exdented too much.
43 uint8_t module; //!< Indentation after the module prefix name.
45
46#include <freeradius-devel/server/request.h>
47#include <freeradius-devel/util/log.h>
48#include <freeradius-devel/util/event.h>
49#include <freeradius-devel/util/pair.h>
50
51/** Logging callback to write log messages to a destination
52 *
53 * This allows the logging destination to be customised on a per request basis.
54 *
55 * @note Logging functions must not block waiting on I/O.
56 *
57 * @param[in] type What type of message this is (error, warn, info, debug).
58 * @param[in] lvl At what logging level this message should be output.
59 * @param[in] file src file the log message was generated in.
60 * @param[in] line number the log message was generated on.
61 * @param[in] request The current request.
62 * @param[in] fmt sprintf style fmt string.
63 * @param[in] ap Arguments for the fmt string.
64 * @param[in] uctx Context data for the log function. Usually an #fr_log_t for vlog_request.
65 */
66typedef void (*log_func_t)(fr_log_type_t type, fr_log_lvl_t lvl, request_t *request,
67 char const *file, int line,
68 char const *fmt, va_list ap, void *uctx);
69
70struct log_dst {
71 log_func_t func; //!< Function to call to log to this destination.
72 void *uctx; //!< Context to pass to the logging function.
73 fr_log_lvl_t lvl; //!< Log messages with lvl >= to this should be logged.
74 log_dst_t *next; //!< Next logging destination.
75};
76
77/** Context structure for the log fd event function
78 *
79 * This enables a file descriptor to be inserted into an event loop
80 * and produce log output. It's useful for execd child processes
81 * and for capturing stdout/stderr from libraries.
82 */
83typedef struct {
84 fr_log_type_t type; //!< What type of log message it is.
85 fr_log_lvl_t lvl; //!< Priority of the message.
86 request_t *request; //!< request to log messages in the context of.
87 char const *prefix; //!< To add to log messages.
89
90/** Function signature for log_request functions
91 *
92 */
94 char const *file, int line,
95 char const *fmt, ...);
96
98extern size_t syslog_facility_table_len;
100extern size_t syslog_severity_table_len;
102extern size_t log_destination_table_len;
103
104#define debug_enabled(_type, _lvl) (((_type & L_DBG) != 0) && (_lvl <= fr_debug_lvl))
105
106bool log_rdebug_enabled(fr_log_lvl_t lvl, request_t const *request) CC_HINT(nonnull);
107
109 char const *file, int line,
110 char const *fmt, va_list ap, void *uctx)
111 CC_HINT(format (printf, 6, 0)) CC_HINT(nonnull (3, 4));
112
114 char const *file, int line,
115 char const *fmt, ...)
116 CC_HINT(format (printf, 6, 7)) CC_HINT(nonnull (3, 6));
117
119 char const *file, int line,
120 char const *fmt, ...)
121 CC_HINT(format (printf, 6, 7)) CC_HINT(nonnull (3, 6));
122
124 char const *file, int line, char const *fmt, ...)
125 CC_HINT(format (printf, 6, 7)) CC_HINT(nonnull (3));
126
127void log_request_pair(fr_log_lvl_t lvl, request_t *request,
128 fr_pair_t const *parent, fr_pair_t const *vp, char const *prefix) CC_HINT(nonnull(2));
129
131 fr_pair_t const *parent, fr_pair_list_t const *vps, char const *prefix)
132 CC_HINT(nonnull(2));
133
135 fr_pair_t const *parent, fr_pair_list_t const *vp, char const *prefix)
136 CC_HINT(nonnull(2));
137
139 char const *file, int line,
140 char const *str, size_t str_len,
141 ssize_t marker_idx, char const *marker, ...) CC_HINT(format (printf, 9, 10)) CC_HINT(nonnull);
142
144 char const *file, int line,
145 uint8_t const *data, size_t data_len) CC_HINT(nonnull);
146
147void log_request_fd_event(UNUSED fr_event_list_t *el, int fd, UNUSED int flags, void *uctx);
148
149void log_fatal(fr_log_t const *log, char const *file, int line, char const *fmt, ...)
150 CC_HINT(format (printf, 4, 5)) CC_HINT(noreturn);
151
154
155fr_log_t *log_dst_by_name(char const *name);
156
157int log_global_init(fr_log_t *log, bool daemonize);
158
159void log_global_free(void);
160
161/*
162 * Sets the default log destination for global messages
163 */
164#ifndef LOG_DST
165# define LOG_DST &default_log
166#endif
167#define _FR_LOG_DST(_lvl, _fmt, ...) fr_log(LOG_DST, _lvl, __FILE__, __LINE__, _fmt, ## __VA_ARGS__)
168#define _FR_LOG_DST_PERROR(_lvl, _fmt, ...) fr_log_perror(LOG_DST, _lvl, __FILE__, __LINE__, NULL, _fmt, ## __VA_ARGS__)
169#define _FR_LOG_DST_FATAL(_fmt, ...) log_fatal(LOG_DST, __FILE__, __LINE__, _fmt, ## __VA_ARGS__)
170
171/** Write a log message with marker
172 *
173 * @param[in] _lvl log level.
174 * @param[in] _str to markup.
175 * @param[in] _str_len length of subject string. May be SIZE_MAX
176 * to print the entire string.
177 * @param[in] _marker_idx Where to place the marker. May be negative.
178 * @param[in] _line_prefix_fmt Prefix to add to all log lines.
179 * @param[in] ... Arguments for _line_prefix_fmt.
180 */
181#define _FR_LOG_DST_MARKER(_lvl, _str, _str_len, _marker_idx, _line_prefix_fmt, ...) \
182 fr_log_marker(LOG_DST, _lvl, __FILE__, __LINE__, _str, _str_len, _marker_idx, _line_prefix_fmt, ## __VA_ARGS__)
183
184/*
185 * Adds a default prefix to all messages in a source file
186 *
187 * The prefix is set with LOG_PREFIX, and arguments may
188 * be passed with LOG_PREFIX_ARGS
189 */
190#ifdef LOG_PREFIX
191# define _FR_LOG_PREFIX(_lvl, _fmt, ...) _FR_LOG_DST(_lvl, "%s - " _fmt, LOG_PREFIX, ## __VA_ARGS__)
192# define _FR_LOG_PREFIX_PERROR(_lvl, _fmt, ...) _FR_LOG_DST_PERROR(_lvl, "%s - " _fmt, LOG_PREFIX, ## __VA_ARGS__)
193# define _FR_LOG_PREFIX_FATAL(_fmt, ...) _FR_LOG_DST_FATAL("%s - " _fmt, LOG_PREFIX, ## __VA_ARGS__)
194# define _FR_LOG_PREFIX_MARKER(_lvl, _str, _str_len, _marker_idx, _marker) _FR_LOG_DST_MARKER(_lvl, _str, _str_len, _marker_idx, _marker, "%s - ", LOG_PREFIX)
195#else
196# define _FR_LOG_PREFIX(_lvl, _fmt, ...) _FR_LOG_DST(_lvl, _fmt, ## __VA_ARGS__)
197# define _FR_LOG_PREFIX_PERROR(_lvl, _fmt, ...) _FR_LOG_DST_PERROR(_lvl, _fmt, ## __VA_ARGS__)
198# define _FR_LOG_PREFIX_FATAL(_fmt, ...) _FR_LOG_DST_FATAL(_fmt, ## __VA_ARGS__)
199# define _FR_LOG_PREFIX_MARKER(_lvl, _str, _str_len, _marker_idx, _marker) _FR_LOG_DST_MARKER(_lvl, _str, _str_len, _marker_idx, _marker, "")
200#endif
201
202/** @name Log global messages
203 *
204 * Write to the global log.
205 *
206 * Messages will always be written irrespective of the debugging level set with ``-x`` or ``-X``.
207 *
208 * @warning If a request_t * is **NOT** available, these macros **MUST** be used.
209 *
210 * @note These macros should only be used for important global events.
211 *
212 * **Debug categories**
213 * Name | Syslog severity | Colour/style | When to use
214 * -------- | ----------------------- | ------------ | -----------
215 * INFO | LOG_INFO | Bold | TBD
216 * WARN | LOG_WARNING | Yellow | Warnings. Impending resource exhaustion, resource exhaustion
217 * ERROR | LOG_ERR | Red | Critical server errors. Malformed queries, failed operations, connection errors, packet processing errors
218 *
219 * @{
220 */
221#define INFO(_fmt, ...) _FR_LOG_PREFIX(L_INFO, _fmt, ## __VA_ARGS__)
222#define WARN(_fmt, ...) _FR_LOG_PREFIX(L_WARN, _fmt, ## __VA_ARGS__)
223#define ERROR(_fmt, ...) _FR_LOG_PREFIX(L_ERR, _fmt, ## __VA_ARGS__)
224#define FATAL(_fmt, ...) _FR_LOG_PREFIX_FATAL(_fmt, ## __VA_ARGS__)
225
226#define PINFO(_fmt, ...) _FR_LOG_PREFIX_PERROR(L_INFO, _fmt, ## __VA_ARGS__)
227#define PWARN(_fmt, ...) _FR_LOG_PREFIX_PERROR(L_WARN, _fmt, ## __VA_ARGS__)
228#define PERROR(_fmt, ...) _FR_LOG_PREFIX_PERROR(L_ERR, _fmt, ## __VA_ARGS__)
229
230#define IMARKER(_str, _marker_idx, _marker) _FR_LOG_PREFIX_MARKER(L_INFO, _str, SIZE_MAX, _marker_idx, _marker)
231#define WMARKER(_str, _marker_idx, _marker) _FR_LOG_PREFIX_MARKER(L_WARN, _str, SIZE_MAX, _marker_idx, _marker)
232#define EMARKER(_str, _marker_idx, _marker) _FR_LOG_PREFIX_MARKER(L_ERR, _str, SIZE_MAX, _marker_idx, _marker)
233/** @} */
234
235/** @name Log global debug messages (DEBUG*)
236 *
237 * Write debugging messages to the global log.
238 *
239 * Messages will be written if the debug level is high enough.
240 *
241 * **Debug categories**
242 * Name | Syslog severity | Colour/style | When to use
243 * -------- | ----------------------- | -------------| -----------
244 * DEBUG | LOG_DEBUG | Regular | Normal debug output
245 *
246 * **Debug levels**
247 * Level | Debug arguments | Macro(s) enabled | When to use
248 * -------- | ----------------------- | ------------------ | -----------
249 * 1 | ``-x`` | DEBUG | Never - Deprecated
250 * 2 | ``-xx`` or ``-X`` | DEBUG, DEBUG2 | Interactions with external entities. Connection management, control socket, triggers, etc...
251 * 3 | ``-xxx`` or ``-Xx`` | DEBUG, DEBUG[2-3] | Lower priority events. Polling for detail files, cleanups, etc...
252 * 4 | ``-xxxx`` or ``-Xxx`` | DEBUG, DEBUG[2-4] | Internal server state debugging.
253 * 5 | ``-xxxxx`` or ``-Xxxx`` | DEBUG, DEBUG[2-5] | Low level internal server state debugging.
254 *
255 * @{
256 */
257#define DEBUG_ENABLED debug_enabled(L_DBG, L_DBG_LVL_1) //!< True if global debug level 1 messages are enabled
258#define DEBUG_ENABLED2 debug_enabled(L_DBG, L_DBG_LVL_2) //!< True if global debug level 1-2 messages are enabled
259#define DEBUG_ENABLED3 debug_enabled(L_DBG, L_DBG_LVL_3) //!< True if global debug level 1-3 messages are enabled
260#define DEBUG_ENABLED4 debug_enabled(L_DBG, L_DBG_LVL_4) //!< True if global debug level 1-3 messages are enabled
261#define DEBUG_ENABLED5 debug_enabled(L_DBG, L_DBG_LVL_MAX) //!< True if global debug level 1-5 messages are enabled
262
263#define _DEBUG_LOG(_type, _lvl, _fmt, ...) if (fr_debug_lvl >= _lvl) _FR_LOG_PREFIX(_type, _fmt, ## __VA_ARGS__)
264#define DEBUG(_fmt, ...) _DEBUG_LOG(L_DBG, L_DBG_LVL_1, _fmt, ## __VA_ARGS__)
265#define DEBUG2(_fmt, ...) _DEBUG_LOG(L_DBG, L_DBG_LVL_2, _fmt, ## __VA_ARGS__)
266#define DEBUG3(_fmt, ...) _DEBUG_LOG(L_DBG, L_DBG_LVL_3, _fmt, ## __VA_ARGS__)
267#define DEBUG4(_fmt, ...) _DEBUG_LOG(L_DBG, L_DBG_LVL_MAX, _fmt, ## __VA_ARGS__)
268#define DEBUGX(_lvl, _fmt, ...) _DEBUG_LOG(L_DBG, _lvl, _fmt, ## __VA_ARGS__)
269
270#define _PDEBUG_LOG(_type, _lvl, _fmt, ...) if (fr_debug_lvl >= _lvl) _FR_LOG_PREFIX_PERROR(_type, _fmt, ## __VA_ARGS__)
271#define PDEBUG(_fmt, ...) _PDEBUG_LOG(L_DBG, L_DBG_LVL_1, _fmt, ## __VA_ARGS__)
272#define PDEBUG2(_fmt, ...) _PDEBUG_LOG(L_DBG, L_DBG_LVL_2, _fmt, ## __VA_ARGS__)
273#define PDEBUG3(_fmt, ...) _PDEBUG_LOG(L_DBG, L_DBG_LVL_3, _fmt, ## __VA_ARGS__)
274#define PDEBUG4(_fmt, ...) _PDEBUG_LOG(L_DBG, L_DBG_LVL_MAX, _fmt, ## __VA_ARGS__)
275#define PDEBUGX(_lvl, _fmt, ...) _PDEBUG_LOG(L_DBG, _lvl, _fmt, ## __VA_ARGS__)
276/** @} */
277
278/** @name Log request-specific messages (R*)
279 *
280 * Write to the request log, or the global log if a request logging function is not set.
281 *
282 * Messages will always be written irrespective of the debugging level set with ``-x`` or ``-X``.
283 *
284 * @note Automatically prepends date (at lvl >= 3), request number, and module, to the log message.
285 * @note If a request_t * is available, these macros should be used.
286 * @note These macros should only be used for important global events.
287 *
288 * **Debug categories**
289 * Name | Syslog severity | Colour/style | When to use
290 * -------- | ----------------------- | -------------| -----------
291 * RINFO | LOG_INFO | Bold | TBD
292 * RWARN | LOG_WARNING | Yellow/Bold | Warnings. Impending resource exhaustion, or resource exhaustion.
293 * RERROR | LOG_ERR | Red/Bold | Critical server errors. Malformed queries, failed operations, connection errors, packet processing errors.
294 * @{
295 */
296#define RINFO(fmt, ...) log_request(L_INFO, L_DBG_LVL_OFF, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__)
297#define RWARN(fmt, ...) log_request(L_DBG_WARN, L_DBG_LVL_OFF, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__)
298#define RERROR(fmt, ...) log_request_error(L_DBG_ERR, L_DBG_LVL_OFF, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__)
299
300#define RPINFO(fmt, ...) log_request_perror(L_DBG_INFO, L_DBG_LVL_OFF, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__)
301#define RPWARN(fmt, ...) log_request_perror(L_DBG_WARN, L_DBG_LVL_OFF, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__)
302#define RPERROR(fmt, ...) log_request_perror(L_DBG_ERR, L_DBG_LVL_OFF, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__)
303/** @} */
304
305/** @name Log request-specific debug (R*DEBUG*)
306 *
307 * Write debug messages to the request log.
308 *
309 * Messages will only be written if a request log function is set and the request or global
310 * debug level is high enough.
311 *
312 * @note Automatically prepends date (at lvl >= 3), request number, and module, to the log message.
313 *
314 * **Debug categories**
315 * Name | Syslog severity | Colour and style | When to use
316 * -------- | ----------------------- | -----------------| -----------
317 * RDEBUG* | LOG_DEBUG | Regular | Normal debugging messages
318 * RIDEBUG* | LOG_DEBUG | Bold | Informational messages.
319 * RWDEBUG* | LOG_DEBUG | Yellow/Bold | Warnings. Invalid configuration, missing or invalid attributes etc...
320 * REDEBUG* | LOG_DEBUG | Red/Bold | Errors. Reject messages, bad values etc...
321 *
322 * **Debug levels**
323 * Level | Debug arguments | Macro(s) enabled | When to use
324 * -------- | ----------------------- | --------------------- | -----------
325 * 1 | ``-x`` | R*DEBUG | Packet processing, entering/exiting virtual servers, results of module calls
326 * 2 | ``-xx`` or ``-X`` | R*DEBUG, R*DEBUG2 | Unlang keyword evaluation. Module debug output, results of queries, or execs, etc...
327 * 3 | ``-xxx`` or ``-Xx`` | R*DEBUG, R*DEBUG[2-3] | Internal server state or packet input. State machine changes, extra attribute info, etc...
328 * 4 | ``-xxxx`` or ``-Xxx`` | R*DEBUG, R*DEBUG[2-4] | Verbose internal server state messages or packet input. Hex dumps, structure dumps, pointer values.
329 * 5 | ``-xxxxx`` or ``-Xxxx`` | R*DEBUG, R*DEBUG[2-5] | Low level internal server state messages.
330 *
331 * @{
332 */
333#define RDEBUG_ENABLED log_rdebug_enabled(L_DBG_LVL_1, request) //!< True if request debug level 1 messages are enabled
334#define RDEBUG_ENABLED2 log_rdebug_enabled(L_DBG_LVL_2, request) //!< True if request debug level 1-2 messages are enabled
335#define RDEBUG_ENABLED3 log_rdebug_enabled(L_DBG_LVL_3, request) //!< True if request debug level 1-3 messages are enabled
336#define RDEBUG_ENABLED4 log_rdebug_enabled(L_DBG_LVL_4, request) //!< True if request debug level 1-4 messages are enabled
337#define RDEBUG_ENABLED5 log_rdebug_enabled(L_DBG_LVL_MAX, request) //!< True if request debug level 1-5 messages are enabled
338#define RDEBUG_ENABLEDX(_x) log_rdebug_enabled(_x, request) //!< True if specified lvl is enabled
339
340#define RDEBUGX(_l, fmt, ...) do { if (request->log.lvl) log_request(L_DBG, _l, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__); } while(0)
341#define RDEBUG(fmt, ...) do { if (request->log.lvl) log_request(L_DBG, L_DBG_LVL_1, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__); } while(0)
342#define RDEBUG2(fmt, ...) do { if (request->log.lvl) log_request(L_DBG, L_DBG_LVL_2, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__); } while(0)
343#define RDEBUG3(fmt, ...) do { if (request->log.lvl) log_request(L_DBG, L_DBG_LVL_3, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__); } while(0)
344#define RDEBUG4(fmt, ...) do { if (request->log.lvl) log_request(L_DBG, L_DBG_LVL_4, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__); } while(0)
345
346#define RPDEBUG(fmt, ...) do { if (request->log.lvl) log_request_perror(L_DBG, L_DBG_LVL_1, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__); } while(0)
347#define RPDEBUG2(fmt, ...) do { if (request->log.lvl) log_request_perror(L_DBG, L_DBG_LVL_2, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__); } while(0)
348#define RPDEBUG3(fmt, ...) do { if (request->log.lvl) log_request_perror(L_DBG, L_DBG_LVL_3, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__); } while(0)
349#define RPDEBUG4(fmt, ...) do { if (request->log.lvl) log_request_perror(L_DBG, L_DBG_LVL_4, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__); } while(0)
350
351#define RIDEBUG(fmt, ...) do { if (request->log.lvl) log_request(L_DBG_INFO, L_DBG_LVL_1, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__); } while(0)
352#define RIDEBUG2(fmt, ...) do { if (request->log.lvl) log_request(L_DBG_INFO, L_DBG_LVL_2, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__); } while(0)
353#define RIDEBUG3(fmt, ...) do { if (request->log.lvl) log_request(L_DBG_INFO, L_DBG_LVL_3, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__); } while(0)
354#define RIDEBUG4(fmt, ...) do { if (request->log.lvl) log_request(L_DBG_INFO, L_DBG_LVL_4, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__); } while(0)
355
356#define RPIDEBUG(fmt, ...) do { if (request->log.lvl) log_request_perror(L_DBG_INFO, L_DBG_LVL_1, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__); } while(0)
357#define RPIDEBUG2(fmt, ...) do { if (request->log.lvl) log_request_perror(L_DBG_INFO, L_DBG_LVL_2, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__); } while(0)
358#define RPIDEBUG3(fmt, ...) do { if (request->log.lvl) log_request_perror(L_DBG_INFO, L_DBG_LVL_3, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__); } while(0)
359#define RPIDEBUG4(fmt, ...) do { if (request->log.lvl) log_request_perror(L_DBG_INFO, L_DBG_LVL_4, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__); } while(0)
360
361#define RWDEBUG(fmt, ...) do { if (request->log.lvl) log_request(L_DBG_WARN, L_DBG_LVL_1, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__); } while(0)
362#define RWDEBUG2(fmt, ...) do { if (request->log.lvl) log_request(L_DBG_WARN, L_DBG_LVL_2, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__); } while(0)
363#define RWDEBUG3(fmt, ...) do { if (request->log.lvl) log_request(L_DBG_WARN, L_DBG_LVL_3, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__); } while(0)
364#define RWDEBUG4(fmt, ...) do { if (request->log.lvl) log_request(L_DBG_WARN, L_DBG_LVL_4, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__); } while(0)
365
366#define RPWDEBUG(fmt, ...) do { if (request->log.lvl) log_request_perror(L_DBG_WARN, L_DBG_LVL_1, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__); } while(0)
367#define RPWDEBUG2(fmt, ...) do { if (request->log.lvl) log_request_perror(L_DBG_WARN, L_DBG_LVL_2, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__); } while(0)
368#define RPWDEBUG3(fmt, ...) do { if (request->log.lvl) log_request_perror(L_DBG_WARN, L_DBG_LVL_3, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__); } while(0)
369#define RPWDEBUG4(fmt, ...) do { if (request->log.lvl) log_request_perror(L_DBG_WARN, L_DBG_LVL_4, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__); } while(0)
370
371#define REDEBUG(fmt, ...) log_request_error(L_DBG_ERR, L_DBG_LVL_1, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__)
372#define REDEBUG2(fmt, ...) log_request_error(L_DBG_ERR, L_DBG_LVL_2, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__)
373#define REDEBUG3(fmt, ...) log_request_error(L_DBG_ERR, L_DBG_LVL_3,request, __FILE__, __LINE__, fmt, ## __VA_ARGS__)
374#define REDEBUG4(fmt, ...) log_request_error(L_DBG_ERR, L_DBG_LVL_MAX, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__)
375
376#define RPEDEBUG(fmt, ...) log_request_perror(L_DBG_ERR, L_DBG_LVL_1, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__)
377#define RPEDEBUG2(fmt, ...) log_request_perror(L_DBG_ERR, L_DBG_LVL_2, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__)
378#define RPEDEBUG3(fmt, ...) log_request_perror(L_DBG_ERR, L_DBG_LVL_3, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__)
379#define RPEDEBUG4(fmt, ...) log_request_perror(L_DBG_ERR, L_DBG_LVL_MAX, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__)
380/** @} */
381
382/** Save indentation for later restoral.
383 *
384 * This call avoids the need to manually REXDENT on error paths. We
385 * can just restore and return.
386 *
387 */
388#define RINDENT_SAVE(_x, _request) do { \
389 (_x)->indent = request->log.indent; \
390 } while (0)
391
392#define RINDENT_RESTORE(_request, _x) do { \
393 request->log.indent = (_x)->indent; \
394 } while (0)
395
396#ifdef DEBUG_INDENT
397/** Indent R* messages by one level
398 *
399 * @note Has no effect on the indentation of INFO, WARN, ERROR, DEBUG messages,
400 * only RINFO, RWARN, RERROR etc...
401 */
402# define RINDENT() do {\
403 if (request->module) {\
404 request->log.module_indent += 2;\
405 } else {\
406 request->log.unlang_indent += 2;\
407 }\
408 RDEBUG4(">> (%i) %s[%u]", request->log.unlang_indent, __FILE__, __LINE__); \
409} while(0)
410
411/** Exdent (unindent) R* messages by one level
412 *
413 * @note Has no effect on the indentation of INFO, WARN, ERROR, DEBUG messages,
414 * only RINFO, RWARN, RERROR etc...
415 */
416# define REXDENT() do {\
417 RDEBUG4("<< (%i) %s[%u]", request->log.unlang_indent, __FILE__, __LINE__); \
418 if (request->module) {\
419 request->log.module_indent -= 2;\
420 } else {\
421 request->log.unlang_indent -= 2;\
422 }\
423} while(0)
424#else
425/** Indent R* messages by one level
426 *
427 * @note Has no effect on the indentation of INFO, WARN, ERROR, DEBUG messages,
428 * only RINFO, RWARN, RERROR etc...
429 */
430# define RINDENT() do {\
431 if (request->module) {\
432 request->log.indent.unlang += 2;\
433 } else {\
434 request->log.indent.unlang += 2;\
435 }\
436} while(0)
437
438/** Exdent (unindent) R* messages by one level
439 *
440 * @note Has no effect on the indentation of INFO, WARN, ERROR, DEBUG messages,
441 * only RINFO, RWARN, RERROR etc...
442 */
443# define REXDENT() do {\
444 if (request->module) {\
445 request->log.indent.unlang -= 2;\
446 } else {\
447 request->log.indent.unlang -= 2;\
448 }\
449} while(0)
450#endif
451
452/** Output string with error marker, showing where format error occurred
453 *
454 @verbatim
455 my pet kitty
456 ^ kitties are not pets, are nature devouring hell beasts
457 @endverbatim
458 *
459 * @warning If a request_t * is **NOT** available, or is NULL, this macro must **NOT** be used.
460 *
461 * @param[in] _type log category, a #fr_log_type_t value.
462 * @param[in] _lvl log priority, a #fr_log_lvl_t value.
463 * @param[in] _str to mark e.g. "my pet kitty".
464 * @param[in] _marker_idx index e.g. 3 (starts from 0).
465 * @param[in] _marker error message e.g. "kitties are not pets, are nature devouring hell beasts".
466 * @param[in] ... arguments for error string.
467 */
468#ifndef DEBUG_INDENT
469#define RMARKER(_type, _lvl, _str, _marker_idx, _marker, ...) \
470 log_request_marker(_type, _lvl, request, \
471 __FILE__, __LINE__, \
472 _str, SIZE_MAX, _marker_idx, _marker, ## __VA_ARGS__)
473#else
474#define RMARKER(_type, _lvl, _str, _marker_idx, _marker, ...) do { \
475 RDEBUG4("== (0) at %s[%u]", __FILE__, __LINE__); \
476 log_request_marker(_type, _lvl, request, \
477 __FILE__, __LINE__, \
478 _str, SIZE_MAX, _marker_idx, _marker, ## __VA_ARGS__); \
479 } while (0)
480#endif
481
482/** Output string with error marker, showing where format error occurred
483 *
484 * These are logged as RERROR messages.
485 *
486 @verbatim
487 my pet kitty
488 ^ kitties are not pets, are nature devouring hell beasts
489 @endverbatim
490 *
491 * @warning If a request_t * is **NOT** available, or is NULL, this macro must **NOT** be used.
492 *
493 * @param[in] _str to mark e.g. "my pet kitty".
494 * @param[in] _marker_idx index e.g. 3 (starts from 0).
495 * @param[in] _marker error message e.g. "kitties are not pets, are nature devouring hell beasts".
496 * @param[in] ... arguments for error string.
497 */
498#define REMARKER(_str, _marker_idx, _marker, ...) RMARKER(L_DBG_ERR, L_DBG_LVL_1, _str, _marker_idx, _marker, ## __VA_ARGS__)
499
500/** Output string with error marker, showing where format error occurred
501 *
502 * These are logged as RDEBUG messages.
503 *
504 @verbatim
505 my pet kitty
506 ^ kitties are not pets, are nature devouring hell beasts
507 @endverbatim
508 *
509 * @warning If a request_t * is **NOT** available, or is NULL, this macro must **NOT** be used.
510 *
511 * @param[in] _str to mark e.g. "my pet kitty".
512 * @param[in] _marker_idx index e.g. 3 (starts from 0).
513 * @param[in] _marker error message e.g. "kitties are not pets, are nature devouring hell beasts".
514 * @param[in] ... arguments for error string.
515 */
516#define RDMARKER(_str, _marker_idx, _marker, ...) RMARKER(L_DBG, L_DBG_LVL_1, _str, _marker_idx, _marker, ## __VA_ARGS__)
517
518/** Use different logging functions depending on whether request is NULL or not.
519 *
520 * This is useful for areas of code which are run on server startup, and when
521 * processing requests.
522 *
523 * @param[in] _l_request The name of a R* logging macro e.g. RDEBUG3.
524 * @param[in] _l_global The name of a global logging macro e.g. DEBUG3.
525 * @param[in] _fmt printf style format string.
526 * @param[in] ... printf arguments.
527 */
528#define ROPTIONAL(_l_request, _l_global, _fmt, ...) \
529do {\
530 if (request) {\
531 _l_request(_fmt, ## __VA_ARGS__);\
532 } else {\
533 _l_global(_fmt, ## __VA_ARGS__);\
534 }\
535} while (0)
536
537/** Check if a debug level is set by the request (if !NULL) or by the global log
538 *
539 * @param[in] _e_request Enabled macro to use for requests.
540 * @param[in] _e_global Enabled macro to use for global.
541 */
542#define ROPTIONAL_ENABLED(_e_request, _e_global) ((request && _e_request) || _e_global)
543
544/** Track when a log message was last repeated
545 *
546 */
547typedef struct {
548 fr_time_t now; //!< Current time - Here because it avoids repeated stack allocation.
549 fr_time_t last_complained; //!< Last time we emitted a log message.
550 unsigned int repeated; //!< Number of "skipped" messages.
552
553/** Rate limit messages using a local limiting entry
554 *
555 * Rate limit log messages so they're written a maximum of once per second.
556 *
557 @code{.c}
558 RATE_LIMIT(&inst->home_server_alive_rate_limit, RERROR, "Home servers alive in pool %s", pool->name));
559 @endcode
560 * @note Rate limits the macro, not the message. If five different messages are
561 * produced using the same macro in the same second, only the first will
562 * be written to the log.
563 *
564 * @param[in] _entry Used to track rate limiting.
565 * @param[in] _log Logging macro.
566 * @param[in] _fmt printf style format string.
567 * @param[in] ... printf arguments.
568 */
569#define RATE_LIMIT_LOCAL(_entry, _log, _fmt, ...) \
570do {\
571 if (fr_rate_limit_enabled()) {\
572 (_entry)->now = fr_time();\
573 if (fr_time_to_sec((_entry)->now) != fr_time_to_sec((_entry)->last_complained)) {\
574 (_entry)->last_complained = (_entry)->now;\
575 if (((_entry)->repeated > 0) && (fr_time_delta_to_sec(fr_time_sub((_entry)->now, (_entry)->last_complained)) == 1)) { \
576 _log(_fmt " - repeated %u time(s)", ##__VA_ARGS__, (_entry)->repeated); \
577 } else { \
578 _log(_fmt, ##__VA_ARGS__); \
579 }\
580 (_entry)->repeated = 0; \
581 } else { \
582 (_entry)->repeated++; \
583 } \
584 } else (_log(_fmt, ##__VA_ARGS__));\
585} while (0)
586
587/** Rate limit messages using a local limiting entry
588 *
589 * Rate limit log messages so they're written a maximum of once per second.
590 * The ROPTIOANL variant allows different logging macros to be used based on whether a request is
591 * available.
592 *
593 @code{.c}
594 RATE_LIMIT(&inst->home_server_alive_rate_limit, RERROR, "Home servers alive in pool %s", pool->name));
595 @endcode
596 * @note Rate limits the macro, not the message. If five different messages are
597 * produced using the same macro in the same second, only the first will
598 * be written to the log.
599 *
600 * @param[in] _entry Used to track rate limiting.
601 * @param[in] _l_request The name of a R* logging macro e.g. RDEBUG3.
602 * @param[in] _l_global The name of a global logging macro e.g. DEBUG3.
603 * @param[in] _fmt printf style format string.
604 * @param[in] ... printf arguments.
605 */
606#define RATE_LIMIT_LOCAL_ROPTIONAL(_entry, _l_request, _l_global, _fmt, ...) \
607do {\
608 if (fr_rate_limit_enabled()) {\
609 (_entry)->now = fr_time();\
610 if (fr_time_to_sec((_entry)->now) != fr_time_to_sec((_entry)->last_complained)) {\
611 (_entry)->last_complained = (_entry)->now;\
612 if (((_entry)->repeated > 0) && (fr_time_delta_to_sec(fr_time_sub((_entry)->now, (_entry)->last_complained)) == 1)) { \
613 ROPTIONAL(_l_request, _l_global, _fmt " - repeated %u time(s)", ##__VA_ARGS__, (_entry)->repeated); \
614 } else { \
615 ROPTIONAL(_l_request, _l_global, _fmt, ##__VA_ARGS__); \
616 }\
617 (_entry)->repeated = 0; \
618 } else { \
619 (_entry)->repeated++; \
620 } \
621 } else { \
622 ROPTIONAL(_l_request, _l_global, _fmt, ##__VA_ARGS__);\
623 } \
624} while (0)
625
626/** Rate limit messages using a global limiting entry
627 *
628 * Rate limit log messages so they're written a maximum of once per second.
629 *
630 @code{.c}
631 RATE_LIMIT(RERROR, "Home servers alive in pool %s", pool->name));
632 @endcode
633 * @note Rate limits the macro, not the message. If five different messages are
634 * produced using the same macro in the same second, only the first will
635 * be written to the log.
636 *
637 * @param[in] _log Logging macro.
638 * @param[in] _fmt printf style format string.
639 * @param[in] ... printf arguments.
640 */
641#define RATE_LIMIT_GLOBAL(_log, _fmt, ...) \
642do {\
643 static fr_rate_limit_t _rate_limit; \
644 RATE_LIMIT_LOCAL(&_rate_limit, _log, _fmt, ##__VA_ARGS__); \
645} while (0)
646
647/** Rate limit messages using a global limiting entry
648 *
649 * Rate limit log messages so they're written a maximum of once per second.
650 *
651 @code{.c}
652 RATE_LIMIT(RERROR, "Home servers alive in pool %s", pool->name));
653 @endcode
654 * @note Rate limits the macro, not the message. If five different messages are
655 * produced using the same macro in the same second, only the first will
656 * be written to the log.
657 *
658 * @param[in] _l_request The name of a R* logging macro e.g. RDEBUG3.
659 * @param[in] _l_global The name of a global logging macro e.g. DEBUG3.
660 * @param[in] _fmt printf style format string.
661 * @param[in] ... printf arguments.
662 */
663#define RATE_LIMIT_GLOBAL_ROPTIONAL(_l_request, _l_global, _fmt, ...) \
664do {\
665 static fr_rate_limit_t _rate_limit; \
666 RATE_LIMIT_LOCAL_ROPTIONAL(&_rate_limit, _l_request, _l_global, _fmt, ##__VA_ARGS__); \
667} while (0)
668
669/** Pretty print binary data, with hex output inline with message
670 *
671 * Output format is @verbatim <msg>0x<hex string> @endverbatim.
672 *
673 * @param[in] _lvl Debug level at which we start emitting the log message.
674 * @param[in] _data Binary data to print.
675 * @param[in] _len Length of binary data.
676 * @param[in] _fmt Message to prefix hex output with.
677 * @param[in] ... Additional arguments to print.
678 */
679#define _RHEXDUMP_INLINE(_lvl, _data, _len, _fmt, ...) \
680 if (log_rdebug_enabled(_lvl, request)) do { \
681 log_request(L_DBG, _lvl, request, __FILE__, __LINE__, _fmt " 0x%pH", ## __VA_ARGS__, fr_box_octets(_data, _len)); \
682 } while (0)
683
684#define RHEXDUMP_INLINE1(_data, _len, _fmt, ...) _RHEXDUMP_INLINE(L_DBG_LVL_1, _data, _len, _fmt, ## __VA_ARGS__)
685#define RHEXDUMP_INLINE2(_data, _len, _fmt, ...) _RHEXDUMP_INLINE(L_DBG_LVL_2, _data, _len, _fmt, ## __VA_ARGS__)
686#define RHEXDUMP_INLINE3(_data, _len, _fmt, ...) _RHEXDUMP_INLINE(L_DBG_LVL_3, _data, _len, _fmt, ## __VA_ARGS__)
687#define RHEXDUMP_INLINE4(_data, _len, _fmt, ...) _RHEXDUMP_INLINE(L_DBG_LVL_4, _data, _len, _fmt, ## __VA_ARGS__)
688
689/** Pretty print binary data as hex, with output as a wrapped block with addresses
690 *
691 * @param[in] _lvl Debug level at which we start emitting the log message.
692 * @param[in] _data Binary data to print.
693 * @param[in] _len Length of binary data.
694 * @param[in] _fmt Message to print as a header to the hex output.
695 * @param[in] ... Additional arguments to print.
696 */
697#define _RHEXDUMP(_lvl, _data, _len, _fmt, ...) \
698 if (log_rdebug_enabled(_lvl, request)) do { \
699 log_request(L_DBG, _lvl, request, __FILE__, __LINE__, _fmt, ## __VA_ARGS__); \
700 log_request_hex(L_DBG, _lvl, request, __FILE__, __LINE__, _data, _len); \
701 } while (0)
702
703#define RHEXDUMP1(_data, _len, _fmt, ...) _RHEXDUMP(L_DBG_LVL_1, _data, _len, _fmt, ## __VA_ARGS__)
704#define RHEXDUMP2(_data, _len, _fmt, ...) _RHEXDUMP(L_DBG_LVL_2, _data, _len, _fmt, ## __VA_ARGS__)
705#define RHEXDUMP3(_data, _len, _fmt, ...) _RHEXDUMP(L_DBG_LVL_3, _data, _len, _fmt, ## __VA_ARGS__)
706#define RHEXDUMP4(_data, _len, _fmt, ...) _RHEXDUMP(L_DBG_LVL_4, _data, _len, _fmt, ## __VA_ARGS__)
707
708/** Pretty print binary data as hex, with output as a wrapped block with addresses
709 *
710 * @param[in] _lvl Debug level at which we start emitting the log message.
711 * @param[in] _data Binary data to print.
712 * @param[in] _len Length of binary data.
713 * @param[in] _fmt Message to prefix hex output with.
714 * @param[in] ... Additional arguments to print.
715 */
716#define _HEXDUMP(_lvl, _data, _len, _fmt, ...) \
717 if (debug_enabled(L_DBG, _lvl)) do { \
718 fr_log_hex(LOG_DST, L_DBG, __FILE__, __LINE__, _data, _len, _fmt, ## __VA_ARGS__); \
719 } while (0)
720
721#define HEXDUMP1(_data, _len, _fmt, ...) _HEXDUMP(L_DBG_LVL_1, _data, _len, _fmt, ## __VA_ARGS__)
722#define HEXDUMP2(_data, _len, _fmt, ...) _HEXDUMP(L_DBG_LVL_2, _data, _len, _fmt, ## __VA_ARGS__)
723#define HEXDUMP3(_data, _len, _fmt, ...) _HEXDUMP(L_DBG_LVL_3, _data, _len, _fmt, ## __VA_ARGS__)
724#define HEXDUMP4(_data, _len, _fmt, ...) _HEXDUMP(L_DBG_LVL_4, _data, _len, _fmt, ## __VA_ARGS__)
725
726/** Pretty print binary data as hex, with output as a wrapped block with addresses and a marker
727 *
728 * @param[in] _lvl Debug level at which we start emitting the log message.
729 * @param[in] _data Binary data to print.
730 * @param[in] _len Length of binary data.
731 * @param[in] _slen Where the marker should be placed.
732 * @param[in] _error to print after the marker.
733 * @param[in] _fmt Message to prefix hex output with.
734 * @param[in] ... Additional arguments to print.
735 */
736#define _HEX_MARKER(_lvl, _data, _len, _slen, _error, _fmt, ...) \
737 if (debug_enabled(L_DBG, _lvl)) do { \
738 fr_log_hex_marker(LOG_DST, L_DBG, __FILE__, __LINE__, _data, _len, _slen, _error, _fmt, ## __VA_ARGS__); \
739 } while (0)
740
741#define HEX_MARKER1(_data, _len, _slen, _error, _fmt, ...) _HEX_MARKER(L_DBG_LVL_1, _data, _len, _slen, _error, _fmt, ## __VA_ARGS__)
742#define HEX_MARKER2(_data, _len, _slen, _error, _fmt, ...) _HEX_MARKER(L_DBG_LVL_2, _data, _len, _slen, _error, _fmt, ## __VA_ARGS__)
743#define HEX_MARKER3(_data, _len, _slen, _error, _fmt, ...) _HEX_MARKER(L_DBG_LVL_3, _data, _len, _slen, _error, _fmt, ## __VA_ARGS__)
744#define HEX_MARKER4(_data, _len, _slen, _error, _fmt, ...) _HEX_MARKER(L_DBG_LVL_4, _data, _len, _slen, _error, _fmt, ## __VA_ARGS__)
int const char * file
Definition acutest.h:702
static int const char * fmt
Definition acutest.h:573
int const char int line
Definition acutest.h:702
#define RCSIDH(h, id)
Definition build.h:484
#define UNUSED
Definition build.h:315
A section grouping multiple CONF_PAIR.
Definition cf_priv.h:101
void log_request_hex(fr_log_type_t type, fr_log_lvl_t lvl, request_t *request, char const *file, int line, uint8_t const *data, size_t data_len)
Definition log.c:928
fr_log_lvl_t lvl
Log messages with lvl >= to this should be logged.
Definition log.h:73
request_t * request
request to log messages in the context of.
Definition log.h:86
void(* log_request_func_t)(fr_log_type_t type, fr_log_lvl_t lvl, request_t *request, char const *file, int line, char const *fmt,...)
Function signature for log_request functions.
Definition log.h:93
fr_table_num_sorted_t const log_destination_table[]
Definition log.c:186
void log_request_pair_list(fr_log_lvl_t lvl, request_t *request, fr_pair_t const *parent, fr_pair_list_t const *vps, char const *prefix))
Print a fr_pair_list_t.
Definition log.c:830
int log_global_init(fr_log_t *log, bool daemonize)
Initialises the server logging functionality, and the underlying libfreeradius log.
Definition log.c:1267
size_t log_destination_table_len
Definition log.c:194
bool log_rdebug_enabled(fr_log_lvl_t lvl, request_t const *request)
Whether a request specific debug message should be logged.
Definition log.c:267
void log_request_marker(fr_log_type_t type, fr_log_lvl_t lvl, request_t *request, char const *file, int line, char const *str, size_t str_len, ssize_t marker_idx, char const *marker,...))
Write the string being parsed, and a marker showing where the parse error occurred.
Definition log.c:886
void log_request_error(fr_log_type_t type, fr_log_lvl_t lvl, request_t *request, char const *file, int line, char const *fmt,...))
Marshal variadic log arguments into a va_list and pass to error logging functions.
Definition log.c:647
fr_log_lvl_t lvl
Priority of the message.
Definition log.h:85
unsigned int repeated
Number of "skipped" messages.
Definition log.h:550
void log_fatal(fr_log_t const *log, char const *file, int line, char const *fmt,...))
Log a fatal error, then exit.
Definition log.c:1039
struct rindent_s rindent_t
void log_request_proto_pair_list(fr_log_lvl_t lvl, request_t *request, fr_pair_t const *parent, fr_pair_list_t const *vp, char const *prefix))
Print a list of protocol fr_pair_ts.
Definition log.c:854
void * uctx
Context to pass to the logging function.
Definition log.h:72
int log_parse_section(CONF_SECTION *cs)
Parse a named logging section.
Definition log.c:1132
void(* log_func_t)(fr_log_type_t type, fr_log_lvl_t lvl, request_t *request, char const *file, int line, char const *fmt, va_list ap, void *uctx)
Logging callback to write log messages to a destination.
Definition log.h:66
fr_table_num_sorted_t const syslog_severity_table[]
Syslog severity table.
Definition log.c:151
fr_log_t * log_dst_by_name(char const *name)
Get a logging destination by name.
Definition log.c:1074
void vlog_request(fr_log_type_t type, fr_log_lvl_t lvl, request_t *request, char const *file, int line, char const *fmt, va_list ap, void *uctx))
Send a log message to its destination, possibly including fields from the request.
Definition log.c:295
fr_time_t now
Current time - Here because it avoids repeated stack allocation.
Definition log.h:548
log_dst_t * next
Next logging destination.
Definition log.h:74
void log_request_pair(fr_log_lvl_t lvl, request_t *request, fr_pair_t const *parent, fr_pair_t const *vp, char const *prefix))
Print a fr_pair_t.
Definition log.c:781
fr_time_t last_complained
Last time we emitted a log message.
Definition log.h:549
void log_request_fd_event(UNUSED fr_event_list_t *el, int fd, UNUSED int flags, void *uctx)
Function to provide as the readable callback to the event loop.
Definition log.c:956
size_t syslog_facility_table_len
Definition log.c:143
void log_request_perror(fr_log_type_t type, fr_log_lvl_t lvl, request_t *request, char const *file, int line, char const *fmt,...))
Drain any outstanding messages from the fr_strerror buffers.
Definition log.c:679
size_t syslog_severity_table_len
Definition log.c:184
void log_request(fr_log_type_t type, fr_log_lvl_t lvl, request_t *request, char const *file, int line, char const *fmt,...))
Marshal variadic log arguments into a va_list and pass to normal logging functions.
Definition log.c:612
char const * prefix
To add to log messages.
Definition log.h:87
fr_log_type_t type
What type of log message it is.
Definition log.h:84
log_func_t func
Function to call to log to this destination.
Definition log.h:71
uint8_t unlang
By how much to indent log messages.
Definition log.h:41
fr_table_num_sorted_t const syslog_facility_table[]
Syslog facility table.
Definition log.c:66
void log_global_free(void)
Definition log.c:1303
Track when a log message was last repeated.
Definition log.h:547
Definition log.h:70
Context structure for the log fd event function.
Definition log.h:83
Stores all information relating to an event list.
Definition event.c:411
fr_log_lvl_t
Definition log.h:67
fr_log_type_t
Definition log.h:54
long int ssize_t
unsigned char uint8_t
static char const * name
fr_aka_sim_id_type_t type
fr_pair_t * vp
Definition log.h:96
Stores an attribute, a value and various bits of other data.
Definition pair.h:68
An element in a lexicographically sorted array of name to num mappings.
Definition table.h:49
"server local" time.
Definition time.h:69
static fr_event_list_t * el
static fr_slen_t parent
Definition pair.h:851
static fr_slen_t data
Definition value.h:1265
int nonnull(2, 5))