The FreeRADIUS server
$Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
|
Macros and function definitions to write log messages, and control the logging system. More...
#include <freeradius-devel/server/request.h>
#include <freeradius-devel/util/log.h>
#include <freeradius-devel/util/event.h>
#include <freeradius-devel/util/pair.h>
Go to the source code of this file.
Data Structures | |
struct | fr_rate_limit_t |
Track when a log message was last repeated. More... | |
struct | log_dst |
struct | log_fd_event_ctx_t |
Context structure for the log fd event function. More... | |
struct | rindent_s |
Macros | |
#define | _FR_LOG_DST(_lvl, _fmt, ...) fr_log(LOG_DST, _lvl, __FILE__, __LINE__, _fmt, ## __VA_ARGS__) |
#define | _FR_LOG_DST_FATAL(_fmt, ...) log_fatal(LOG_DST, __FILE__, __LINE__, _fmt, ## __VA_ARGS__) |
#define | _FR_LOG_DST_MARKER(_lvl, _str, _str_len, _marker_idx, _line_prefix_fmt, ...) fr_log_marker(LOG_DST, _lvl, __FILE__, __LINE__, _str, _str_len, _marker_idx, _line_prefix_fmt, ## __VA_ARGS__) |
Write a log message with marker. More... | |
#define | _FR_LOG_DST_PERROR(_lvl, _fmt, ...) fr_log_perror(LOG_DST, _lvl, __FILE__, __LINE__, NULL, _fmt, ## __VA_ARGS__) |
#define | _FR_LOG_PREFIX(_lvl, _fmt, ...) _FR_LOG_DST(_lvl, _fmt, ## __VA_ARGS__) |
#define | _FR_LOG_PREFIX_FATAL(_fmt, ...) _FR_LOG_DST_FATAL(_fmt, ## __VA_ARGS__) |
#define | _FR_LOG_PREFIX_MARKER(_lvl, _str, _str_len, _marker_idx, _marker) _FR_LOG_DST_MARKER(_lvl, _str, _str_len, _marker_idx, _marker, "") |
#define | _FR_LOG_PREFIX_PERROR(_lvl, _fmt, ...) _FR_LOG_DST_PERROR(_lvl, _fmt, ## __VA_ARGS__) |
#define | _HEX_MARKER(_lvl, _data, _len, _slen, _error, _fmt, ...) |
Pretty print binary data as hex, with output as a wrapped block with addresses and a marker. More... | |
#define | _HEXDUMP(_lvl, _data, _len, _fmt, ...) |
Pretty print binary data as hex, with output as a wrapped block with addresses. More... | |
#define | _RHEXDUMP(_lvl, _data, _len, _fmt, ...) |
Pretty print binary data as hex, with output as a wrapped block with addresses. More... | |
#define | _RHEXDUMP_INLINE(_lvl, _data, _len, _fmt, ...) |
Pretty print binary data, with hex output inline with message. More... | |
#define | debug_enabled(_type, _lvl) (((_type & L_DBG) != 0) && (_lvl <= fr_debug_lvl)) |
#define | HEX_MARKER1(_data, _len, _slen, _error, _fmt, ...) _HEX_MARKER(L_DBG_LVL_1, _data, _len, _slen, _error, _fmt, ## __VA_ARGS__) |
#define | HEX_MARKER2(_data, _len, _slen, _error, _fmt, ...) _HEX_MARKER(L_DBG_LVL_2, _data, _len, _slen, _error, _fmt, ## __VA_ARGS__) |
#define | HEX_MARKER3(_data, _len, _slen, _error, _fmt, ...) _HEX_MARKER(L_DBG_LVL_3, _data, _len, _slen, _error, _fmt, ## __VA_ARGS__) |
#define | HEX_MARKER4(_data, _len, _slen, _error, _fmt, ...) _HEX_MARKER(L_DBG_LVL_4, _data, _len, _slen, _error, _fmt, ## __VA_ARGS__) |
#define | HEXDUMP1(_data, _len, _fmt, ...) _HEXDUMP(L_DBG_LVL_1, _data, _len, _fmt, ## __VA_ARGS__) |
#define | HEXDUMP2(_data, _len, _fmt, ...) _HEXDUMP(L_DBG_LVL_2, _data, _len, _fmt, ## __VA_ARGS__) |
#define | HEXDUMP3(_data, _len, _fmt, ...) _HEXDUMP(L_DBG_LVL_3, _data, _len, _fmt, ## __VA_ARGS__) |
#define | HEXDUMP4(_data, _len, _fmt, ...) _HEXDUMP(L_DBG_LVL_4, _data, _len, _fmt, ## __VA_ARGS__) |
#define | LOG_DST &default_log |
#define | RATE_LIMIT_GLOBAL(_log, _fmt, ...) |
Rate limit messages using a global limiting entry. More... | |
#define | RATE_LIMIT_GLOBAL_ROPTIONAL(_l_request, _l_global, _fmt, ...) |
Rate limit messages using a global limiting entry. More... | |
#define | RATE_LIMIT_LOCAL(_entry, _log, _fmt, ...) |
Rate limit messages using a local limiting entry. More... | |
#define | RATE_LIMIT_LOCAL_ROPTIONAL(_entry, _l_request, _l_global, _fmt, ...) |
Rate limit messages using a local limiting entry. More... | |
#define | RDMARKER(_str, _marker_idx, _marker, ...) RMARKER(L_DBG, L_DBG_LVL_1, _str, _marker_idx, _marker, ## __VA_ARGS__) |
Output string with error marker, showing where format error occurred. More... | |
#define | REMARKER(_str, _marker_idx, _marker, ...) RMARKER(L_DBG_ERR, L_DBG_LVL_1, _str, _marker_idx, _marker, ## __VA_ARGS__) |
Output string with error marker, showing where format error occurred. More... | |
#define | REXDENT() |
Exdent (unindent) R* messages by one level. More... | |
#define | RHEXDUMP1(_data, _len, _fmt, ...) _RHEXDUMP(L_DBG_LVL_1, _data, _len, _fmt, ## __VA_ARGS__) |
#define | RHEXDUMP2(_data, _len, _fmt, ...) _RHEXDUMP(L_DBG_LVL_2, _data, _len, _fmt, ## __VA_ARGS__) |
#define | RHEXDUMP3(_data, _len, _fmt, ...) _RHEXDUMP(L_DBG_LVL_3, _data, _len, _fmt, ## __VA_ARGS__) |
#define | RHEXDUMP4(_data, _len, _fmt, ...) _RHEXDUMP(L_DBG_LVL_4, _data, _len, _fmt, ## __VA_ARGS__) |
#define | RHEXDUMP_INLINE1(_data, _len, _fmt, ...) _RHEXDUMP_INLINE(L_DBG_LVL_1, _data, _len, _fmt, ## __VA_ARGS__) |
#define | RHEXDUMP_INLINE2(_data, _len, _fmt, ...) _RHEXDUMP_INLINE(L_DBG_LVL_2, _data, _len, _fmt, ## __VA_ARGS__) |
#define | RHEXDUMP_INLINE3(_data, _len, _fmt, ...) _RHEXDUMP_INLINE(L_DBG_LVL_3, _data, _len, _fmt, ## __VA_ARGS__) |
#define | RHEXDUMP_INLINE4(_data, _len, _fmt, ...) _RHEXDUMP_INLINE(L_DBG_LVL_4, _data, _len, _fmt, ## __VA_ARGS__) |
#define | RINDENT() |
Indent R* messages by one level. More... | |
#define | RINDENT_RESTORE(_request, _x) |
#define | RINDENT_SAVE(_x, _request) |
Save indentation for later restoral. More... | |
#define | RMARKER(_type, _lvl, _str, _marker_idx, _marker, ...) |
Output string with error marker, showing where format error occurred. More... | |
#define | ROPTIONAL(_l_request, _l_global, _fmt, ...) |
Use different logging functions depending on whether request is NULL or not. More... | |
#define | ROPTIONAL_ENABLED(_e_request, _e_global) ((request && _e_request) || _e_global) |
Check if a debug level is set by the request (if !NULL) or by the global log. More... | |
Typedefs | |
typedef struct cf_section | CONF_SECTION |
typedef struct log_dst | log_dst_t |
A logging destination, consisting of a function and its context. More... | |
typedef 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. More... | |
typedef 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. More... | |
typedef struct rindent_s | rindent_t |
Functions | |
fr_log_t * | log_dst_by_name (char const *name) |
Get a logging destination by name. More... | |
void | log_fatal (fr_log_t const *log, char const *file, int line, char const *fmt,...)) |
Log a fatal error, then exit. More... | |
void | log_global_free (void) |
int | log_global_init (fr_log_t *log, bool daemonize) |
Initialises the server logging functionality, and the underlying libfreeradius log. More... | |
int | log_parse_section (CONF_SECTION *cs) |
Parse a named logging section. More... | |
bool | log_rdebug_enabled (fr_log_lvl_t lvl, request_t const *request) |
Whether a request specific debug message should be logged. More... | |
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. More... | |
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. More... | |
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. More... | |
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) |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
Variables | |
fr_table_num_sorted_t const | log_destination_table [] |
size_t | log_destination_table_len |
fr_table_num_sorted_t const | syslog_facility_table [] |
Syslog facility table. More... | |
size_t | syslog_facility_table_len |
fr_table_num_sorted_t const | syslog_severity_table [] |
Syslog severity table. More... | |
size_t | syslog_severity_table_len |
Log global messages | |||||||||||||||||
Messages will always be written irrespective of the debugging level set with
Debug categories
| |||||||||||||||||
#define | EMARKER(_str, _marker_idx, _marker) _FR_LOG_PREFIX_MARKER(L_ERR, _str, SIZE_MAX, _marker_idx, _marker) | ||||||||||||||||
#define | ERROR(_fmt, ...) _FR_LOG_PREFIX(L_ERR, _fmt, ## __VA_ARGS__) | ||||||||||||||||
#define | FATAL(_fmt, ...) _FR_LOG_PREFIX_FATAL(_fmt, ## __VA_ARGS__) | ||||||||||||||||
#define | IMARKER(_str, _marker_idx, _marker) _FR_LOG_PREFIX_MARKER(L_INFO, _str, SIZE_MAX, _marker_idx, _marker) | ||||||||||||||||
#define | INFO(_fmt, ...) _FR_LOG_PREFIX(L_INFO, _fmt, ## __VA_ARGS__) | ||||||||||||||||
#define | PERROR(_fmt, ...) _FR_LOG_PREFIX_PERROR(L_ERR, _fmt, ## __VA_ARGS__) | ||||||||||||||||
#define | PINFO(_fmt, ...) _FR_LOG_PREFIX_PERROR(L_INFO, _fmt, ## __VA_ARGS__) | ||||||||||||||||
#define | PWARN(_fmt, ...) _FR_LOG_PREFIX_PERROR(L_WARN, _fmt, ## __VA_ARGS__) | ||||||||||||||||
#define | WARN(_fmt, ...) _FR_LOG_PREFIX(L_WARN, _fmt, ## __VA_ARGS__) | ||||||||||||||||
#define | WMARKER(_str, _marker_idx, _marker) _FR_LOG_PREFIX_MARKER(L_WARN, _str, SIZE_MAX, _marker_idx, _marker) | ||||||||||||||||
Log global debug messages (DEBUG*) | |||||||||||||||||||||||||||||||||
Write debugging messages to the global log. Messages will be written if the debug level is high enough. Debug categories
Debug levels
| |||||||||||||||||||||||||||||||||
#define | _DEBUG_LOG(_type, _lvl, _fmt, ...) if (fr_debug_lvl >= _lvl) _FR_LOG_PREFIX(_type, _fmt, ## __VA_ARGS__) | ||||||||||||||||||||||||||||||||
#define | _PDEBUG_LOG(_type, _lvl, _fmt, ...) if (fr_debug_lvl >= _lvl) _FR_LOG_PREFIX_PERROR(_type, _fmt, ## __VA_ARGS__) | ||||||||||||||||||||||||||||||||
#define | DEBUG(_fmt, ...) _DEBUG_LOG(L_DBG, L_DBG_LVL_1, _fmt, ## __VA_ARGS__) | ||||||||||||||||||||||||||||||||
#define | DEBUG2(_fmt, ...) _DEBUG_LOG(L_DBG, L_DBG_LVL_2, _fmt, ## __VA_ARGS__) | ||||||||||||||||||||||||||||||||
#define | DEBUG3(_fmt, ...) _DEBUG_LOG(L_DBG, L_DBG_LVL_3, _fmt, ## __VA_ARGS__) | ||||||||||||||||||||||||||||||||
#define | DEBUG4(_fmt, ...) _DEBUG_LOG(L_DBG, L_DBG_LVL_MAX, _fmt, ## __VA_ARGS__) | ||||||||||||||||||||||||||||||||
#define | DEBUG_ENABLED debug_enabled(L_DBG, L_DBG_LVL_1) | ||||||||||||||||||||||||||||||||
True if global debug level 1 messages are enabled. More... | |||||||||||||||||||||||||||||||||
#define | DEBUG_ENABLED2 debug_enabled(L_DBG, L_DBG_LVL_2) | ||||||||||||||||||||||||||||||||
True if global debug level 1-2 messages are enabled. More... | |||||||||||||||||||||||||||||||||
#define | DEBUG_ENABLED3 debug_enabled(L_DBG, L_DBG_LVL_3) | ||||||||||||||||||||||||||||||||
True if global debug level 1-3 messages are enabled. More... | |||||||||||||||||||||||||||||||||
#define | DEBUG_ENABLED4 debug_enabled(L_DBG, L_DBG_LVL_4) | ||||||||||||||||||||||||||||||||
True if global debug level 1-3 messages are enabled. More... | |||||||||||||||||||||||||||||||||
#define | DEBUG_ENABLED5 debug_enabled(L_DBG, L_DBG_LVL_MAX) | ||||||||||||||||||||||||||||||||
True if global debug level 1-5 messages are enabled. More... | |||||||||||||||||||||||||||||||||
#define | DEBUGX(_lvl, _fmt, ...) _DEBUG_LOG(L_DBG, _lvl, _fmt, ## __VA_ARGS__) | ||||||||||||||||||||||||||||||||
#define | PDEBUG(_fmt, ...) _PDEBUG_LOG(L_DBG, L_DBG_LVL_1, _fmt, ## __VA_ARGS__) | ||||||||||||||||||||||||||||||||
#define | PDEBUG2(_fmt, ...) _PDEBUG_LOG(L_DBG, L_DBG_LVL_2, _fmt, ## __VA_ARGS__) | ||||||||||||||||||||||||||||||||
#define | PDEBUG3(_fmt, ...) _PDEBUG_LOG(L_DBG, L_DBG_LVL_3, _fmt, ## __VA_ARGS__) | ||||||||||||||||||||||||||||||||
#define | PDEBUG4(_fmt, ...) _PDEBUG_LOG(L_DBG, L_DBG_LVL_MAX, _fmt, ## __VA_ARGS__) | ||||||||||||||||||||||||||||||||
#define | PDEBUGX(_lvl, _fmt, ...) _PDEBUG_LOG(L_DBG, _lvl, _fmt, ## __VA_ARGS__) | ||||||||||||||||||||||||||||||||
Log request-specific messages (R*) | |||||||||||||||||
Write to the request log, or the global log if a request logging function is not set. Messages will always be written irrespective of the debugging level set with
Debug categories
| |||||||||||||||||
#define | RERROR(fmt, ...) log_request_error(L_DBG_ERR, L_DBG_LVL_OFF, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__) | ||||||||||||||||
#define | RINFO(fmt, ...) log_request(L_INFO, L_DBG_LVL_OFF, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__) | ||||||||||||||||
#define | RPERROR(fmt, ...) log_request_perror(L_DBG_ERR, L_DBG_LVL_OFF, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__) | ||||||||||||||||
#define | RPINFO(fmt, ...) log_request_perror(L_DBG_INFO, L_DBG_LVL_OFF, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__) | ||||||||||||||||
#define | RPWARN(fmt, ...) log_request_perror(L_DBG_WARN, L_DBG_LVL_OFF, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__) | ||||||||||||||||
#define | RWARN(fmt, ...) log_request(L_DBG_WARN, L_DBG_LVL_OFF, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__) | ||||||||||||||||
Log request-specific debug (R*DEBUG*) | |||||||||||||||||||||||||||||||||||||||||||||
Write debug messages to the request log. Messages will only be written if a request log function is set and the request or global debug level is high enough.
Debug categories
Debug levels
| |||||||||||||||||||||||||||||||||||||||||||||
#define | RDEBUG(fmt, ...) do { if (request->log.lvl) log_request(L_DBG, L_DBG_LVL_1, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__); } while(0) | ||||||||||||||||||||||||||||||||||||||||||||
#define | RDEBUG2(fmt, ...) do { if (request->log.lvl) log_request(L_DBG, L_DBG_LVL_2, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__); } while(0) | ||||||||||||||||||||||||||||||||||||||||||||
#define | RDEBUG3(fmt, ...) do { if (request->log.lvl) log_request(L_DBG, L_DBG_LVL_3, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__); } while(0) | ||||||||||||||||||||||||||||||||||||||||||||
#define | RDEBUG4(fmt, ...) do { if (request->log.lvl) log_request(L_DBG, L_DBG_LVL_4, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__); } while(0) | ||||||||||||||||||||||||||||||||||||||||||||
#define | RDEBUG_ENABLED log_rdebug_enabled(L_DBG_LVL_1, request) | ||||||||||||||||||||||||||||||||||||||||||||
True if request debug level 1 messages are enabled. More... | |||||||||||||||||||||||||||||||||||||||||||||
#define | RDEBUG_ENABLED2 log_rdebug_enabled(L_DBG_LVL_2, request) | ||||||||||||||||||||||||||||||||||||||||||||
True if request debug level 1-2 messages are enabled. More... | |||||||||||||||||||||||||||||||||||||||||||||
#define | RDEBUG_ENABLED3 log_rdebug_enabled(L_DBG_LVL_3, request) | ||||||||||||||||||||||||||||||||||||||||||||
True if request debug level 1-3 messages are enabled. More... | |||||||||||||||||||||||||||||||||||||||||||||
#define | RDEBUG_ENABLED4 log_rdebug_enabled(L_DBG_LVL_4, request) | ||||||||||||||||||||||||||||||||||||||||||||
True if request debug level 1-4 messages are enabled. More... | |||||||||||||||||||||||||||||||||||||||||||||
#define | RDEBUG_ENABLED5 log_rdebug_enabled(L_DBG_LVL_MAX, request) | ||||||||||||||||||||||||||||||||||||||||||||
True if request debug level 1-5 messages are enabled. More... | |||||||||||||||||||||||||||||||||||||||||||||
#define | RDEBUG_ENABLEDX(_x) log_rdebug_enabled(_x, request) | ||||||||||||||||||||||||||||||||||||||||||||
True if specified lvl is enabled. More... | |||||||||||||||||||||||||||||||||||||||||||||
#define | RDEBUGX(_l, fmt, ...) do { if (request->log.lvl) log_request(L_DBG, _l, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__); } while(0) | ||||||||||||||||||||||||||||||||||||||||||||
#define | REDEBUG(fmt, ...) log_request_error(L_DBG_ERR, L_DBG_LVL_1, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__) | ||||||||||||||||||||||||||||||||||||||||||||
#define | REDEBUG2(fmt, ...) log_request_error(L_DBG_ERR, L_DBG_LVL_2, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__) | ||||||||||||||||||||||||||||||||||||||||||||
#define | REDEBUG3(fmt, ...) log_request_error(L_DBG_ERR, L_DBG_LVL_3,request, __FILE__, __LINE__, fmt, ## __VA_ARGS__) | ||||||||||||||||||||||||||||||||||||||||||||
#define | REDEBUG4(fmt, ...) log_request_error(L_DBG_ERR, L_DBG_LVL_MAX, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__) | ||||||||||||||||||||||||||||||||||||||||||||
#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) | ||||||||||||||||||||||||||||||||||||||||||||
#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) | ||||||||||||||||||||||||||||||||||||||||||||
#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) | ||||||||||||||||||||||||||||||||||||||||||||
#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) | ||||||||||||||||||||||||||||||||||||||||||||
#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) | ||||||||||||||||||||||||||||||||||||||||||||
#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) | ||||||||||||||||||||||||||||||||||||||||||||
#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) | ||||||||||||||||||||||||||||||||||||||||||||
#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) | ||||||||||||||||||||||||||||||||||||||||||||
#define | RPEDEBUG(fmt, ...) log_request_perror(L_DBG_ERR, L_DBG_LVL_1, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__) | ||||||||||||||||||||||||||||||||||||||||||||
#define | RPEDEBUG2(fmt, ...) log_request_perror(L_DBG_ERR, L_DBG_LVL_2, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__) | ||||||||||||||||||||||||||||||||||||||||||||
#define | RPEDEBUG3(fmt, ...) log_request_perror(L_DBG_ERR, L_DBG_LVL_3, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__) | ||||||||||||||||||||||||||||||||||||||||||||
#define | RPEDEBUG4(fmt, ...) log_request_perror(L_DBG_ERR, L_DBG_LVL_MAX, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__) | ||||||||||||||||||||||||||||||||||||||||||||
#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) | ||||||||||||||||||||||||||||||||||||||||||||
#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) | ||||||||||||||||||||||||||||||||||||||||||||
#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) | ||||||||||||||||||||||||||||||||||||||||||||
#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) | ||||||||||||||||||||||||||||||||||||||||||||
#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) | ||||||||||||||||||||||||||||||||||||||||||||
#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) | ||||||||||||||||||||||||||||||||||||||||||||
#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) | ||||||||||||||||||||||||||||||||||||||||||||
#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) | ||||||||||||||||||||||||||||||||||||||||||||
#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) | ||||||||||||||||||||||||||||||||||||||||||||
#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) | ||||||||||||||||||||||||||||||||||||||||||||
#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) | ||||||||||||||||||||||||||||||||||||||||||||
#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) | ||||||||||||||||||||||||||||||||||||||||||||
Macros and function definitions to write log messages, and control the logging system.
Definition in file log.h.
struct fr_rate_limit_t |
struct log_dst |
Data Fields | ||
---|---|---|
log_func_t | func | Function to call to log to this destination. |
fr_log_lvl_t | lvl | Log messages with lvl >= to this should be logged. |
log_dst_t * | next | Next logging destination. |
void * | uctx | Context to pass to the logging function. |
struct log_fd_event_ctx_t |
Context structure for the log fd event function.
This enables a file descriptor to be inserted into an event loop and produce log output. It's useful for execd child processes and for capturing stdout/stderr from libraries.
Data Fields | ||
---|---|---|
fr_log_lvl_t | lvl | Priority of the message. |
char const * | prefix | To add to log messages. |
request_t * | request | request to log messages in the context of. |
fr_log_type_t | type | What type of log message it is. |
struct rindent_s |
#define _DEBUG_LOG | ( | _type, | |
_lvl, | |||
_fmt, | |||
... | |||
) | if (fr_debug_lvl >= _lvl) _FR_LOG_PREFIX(_type, _fmt, ## __VA_ARGS__) |
#define _FR_LOG_DST_MARKER | ( | _lvl, | |
_str, | |||
_str_len, | |||
_marker_idx, | |||
_line_prefix_fmt, | |||
... | |||
) | fr_log_marker(LOG_DST, _lvl, __FILE__, __LINE__, _str, _str_len, _marker_idx, _line_prefix_fmt, ## __VA_ARGS__) |
Write a log message with marker.
[in] | _lvl | log level. |
[in] | _str | to markup. |
[in] | _str_len | length of subject string. May be SIZE_MAX to print the entire string. |
[in] | _marker_idx | Where to place the marker. May be negative. |
[in] | _line_prefix_fmt | Prefix to add to all log lines. |
[in] | ... | Arguments for _line_prefix_fmt. |
#define _FR_LOG_DST_PERROR | ( | _lvl, | |
_fmt, | |||
... | |||
) | fr_log_perror(LOG_DST, _lvl, __FILE__, __LINE__, NULL, _fmt, ## __VA_ARGS__) |
#define _FR_LOG_PREFIX | ( | _lvl, | |
_fmt, | |||
... | |||
) | _FR_LOG_DST(_lvl, _fmt, ## __VA_ARGS__) |
#define _FR_LOG_PREFIX_FATAL | ( | _fmt, | |
... | |||
) | _FR_LOG_DST_FATAL(_fmt, ## __VA_ARGS__) |
#define _FR_LOG_PREFIX_MARKER | ( | _lvl, | |
_str, | |||
_str_len, | |||
_marker_idx, | |||
_marker | |||
) | _FR_LOG_DST_MARKER(_lvl, _str, _str_len, _marker_idx, _marker, "") |
#define _FR_LOG_PREFIX_PERROR | ( | _lvl, | |
_fmt, | |||
... | |||
) | _FR_LOG_DST_PERROR(_lvl, _fmt, ## __VA_ARGS__) |
#define _HEX_MARKER | ( | _lvl, | |
_data, | |||
_len, | |||
_slen, | |||
_error, | |||
_fmt, | |||
... | |||
) |
Pretty print binary data as hex, with output as a wrapped block with addresses and a marker.
[in] | _lvl | Debug level at which we start emitting the log message. |
[in] | _data | Binary data to print. |
[in] | _len | Length of binary data. |
[in] | _slen | Where the marker should be placed. |
[in] | _error | to print after the marker. |
[in] | _fmt | Message to prefix hex output with. |
[in] | ... | Additional arguments to print. |
#define _HEXDUMP | ( | _lvl, | |
_data, | |||
_len, | |||
_fmt, | |||
... | |||
) |
Pretty print binary data as hex, with output as a wrapped block with addresses.
[in] | _lvl | Debug level at which we start emitting the log message. |
[in] | _data | Binary data to print. |
[in] | _len | Length of binary data. |
[in] | _fmt | Message to prefix hex output with. |
[in] | ... | Additional arguments to print. |
#define _PDEBUG_LOG | ( | _type, | |
_lvl, | |||
_fmt, | |||
... | |||
) | if (fr_debug_lvl >= _lvl) _FR_LOG_PREFIX_PERROR(_type, _fmt, ## __VA_ARGS__) |
#define _RHEXDUMP | ( | _lvl, | |
_data, | |||
_len, | |||
_fmt, | |||
... | |||
) |
Pretty print binary data as hex, with output as a wrapped block with addresses.
[in] | _lvl | Debug level at which we start emitting the log message. |
[in] | _data | Binary data to print. |
[in] | _len | Length of binary data. |
[in] | _fmt | Message to print as a header to the hex output. |
[in] | ... | Additional arguments to print. |
#define _RHEXDUMP_INLINE | ( | _lvl, | |
_data, | |||
_len, | |||
_fmt, | |||
... | |||
) |
Pretty print binary data, with hex output inline with message.
Output format is
<msg>0x<hex string>
.
[in] | _lvl | Debug level at which we start emitting the log message. |
[in] | _data | Binary data to print. |
[in] | _len | Length of binary data. |
[in] | _fmt | Message to prefix hex output with. |
[in] | ... | Additional arguments to print. |
#define DEBUG | ( | _fmt, | |
... | |||
) | _DEBUG_LOG(L_DBG, L_DBG_LVL_1, _fmt, ## __VA_ARGS__) |
#define DEBUG2 | ( | _fmt, | |
... | |||
) | _DEBUG_LOG(L_DBG, L_DBG_LVL_2, _fmt, ## __VA_ARGS__) |
#define DEBUG3 | ( | _fmt, | |
... | |||
) | _DEBUG_LOG(L_DBG, L_DBG_LVL_3, _fmt, ## __VA_ARGS__) |
#define DEBUG4 | ( | _fmt, | |
... | |||
) | _DEBUG_LOG(L_DBG, L_DBG_LVL_MAX, _fmt, ## __VA_ARGS__) |
#define debug_enabled | ( | _type, | |
_lvl | |||
) | (((_type & L_DBG) != 0) && (_lvl <= fr_debug_lvl)) |
#define DEBUG_ENABLED debug_enabled(L_DBG, L_DBG_LVL_1) |
#define DEBUG_ENABLED2 debug_enabled(L_DBG, L_DBG_LVL_2) |
#define DEBUG_ENABLED3 debug_enabled(L_DBG, L_DBG_LVL_3) |
#define DEBUG_ENABLED4 debug_enabled(L_DBG, L_DBG_LVL_4) |
#define DEBUG_ENABLED5 debug_enabled(L_DBG, L_DBG_LVL_MAX) |
#define DEBUGX | ( | _lvl, | |
_fmt, | |||
... | |||
) | _DEBUG_LOG(L_DBG, _lvl, _fmt, ## __VA_ARGS__) |
#define EMARKER | ( | _str, | |
_marker_idx, | |||
_marker | |||
) | _FR_LOG_PREFIX_MARKER(L_ERR, _str, SIZE_MAX, _marker_idx, _marker) |
#define ERROR | ( | _fmt, | |
... | |||
) | _FR_LOG_PREFIX(L_ERR, _fmt, ## __VA_ARGS__) |
#define FATAL | ( | _fmt, | |
... | |||
) | _FR_LOG_PREFIX_FATAL(_fmt, ## __VA_ARGS__) |
#define HEX_MARKER1 | ( | _data, | |
_len, | |||
_slen, | |||
_error, | |||
_fmt, | |||
... | |||
) | _HEX_MARKER(L_DBG_LVL_1, _data, _len, _slen, _error, _fmt, ## __VA_ARGS__) |
#define HEX_MARKER2 | ( | _data, | |
_len, | |||
_slen, | |||
_error, | |||
_fmt, | |||
... | |||
) | _HEX_MARKER(L_DBG_LVL_2, _data, _len, _slen, _error, _fmt, ## __VA_ARGS__) |
#define HEX_MARKER3 | ( | _data, | |
_len, | |||
_slen, | |||
_error, | |||
_fmt, | |||
... | |||
) | _HEX_MARKER(L_DBG_LVL_3, _data, _len, _slen, _error, _fmt, ## __VA_ARGS__) |
#define HEX_MARKER4 | ( | _data, | |
_len, | |||
_slen, | |||
_error, | |||
_fmt, | |||
... | |||
) | _HEX_MARKER(L_DBG_LVL_4, _data, _len, _slen, _error, _fmt, ## __VA_ARGS__) |
#define HEXDUMP1 | ( | _data, | |
_len, | |||
_fmt, | |||
... | |||
) | _HEXDUMP(L_DBG_LVL_1, _data, _len, _fmt, ## __VA_ARGS__) |
#define HEXDUMP2 | ( | _data, | |
_len, | |||
_fmt, | |||
... | |||
) | _HEXDUMP(L_DBG_LVL_2, _data, _len, _fmt, ## __VA_ARGS__) |
#define HEXDUMP3 | ( | _data, | |
_len, | |||
_fmt, | |||
... | |||
) | _HEXDUMP(L_DBG_LVL_3, _data, _len, _fmt, ## __VA_ARGS__) |
#define HEXDUMP4 | ( | _data, | |
_len, | |||
_fmt, | |||
... | |||
) | _HEXDUMP(L_DBG_LVL_4, _data, _len, _fmt, ## __VA_ARGS__) |
#define IMARKER | ( | _str, | |
_marker_idx, | |||
_marker | |||
) | _FR_LOG_PREFIX_MARKER(L_INFO, _str, SIZE_MAX, _marker_idx, _marker) |
#define INFO | ( | _fmt, | |
... | |||
) | _FR_LOG_PREFIX(L_INFO, _fmt, ## __VA_ARGS__) |
#define LOG_DST &default_log |
#define PDEBUG | ( | _fmt, | |
... | |||
) | _PDEBUG_LOG(L_DBG, L_DBG_LVL_1, _fmt, ## __VA_ARGS__) |
#define PDEBUG2 | ( | _fmt, | |
... | |||
) | _PDEBUG_LOG(L_DBG, L_DBG_LVL_2, _fmt, ## __VA_ARGS__) |
#define PDEBUG3 | ( | _fmt, | |
... | |||
) | _PDEBUG_LOG(L_DBG, L_DBG_LVL_3, _fmt, ## __VA_ARGS__) |
#define PDEBUG4 | ( | _fmt, | |
... | |||
) | _PDEBUG_LOG(L_DBG, L_DBG_LVL_MAX, _fmt, ## __VA_ARGS__) |
#define PDEBUGX | ( | _lvl, | |
_fmt, | |||
... | |||
) | _PDEBUG_LOG(L_DBG, _lvl, _fmt, ## __VA_ARGS__) |
#define PERROR | ( | _fmt, | |
... | |||
) | _FR_LOG_PREFIX_PERROR(L_ERR, _fmt, ## __VA_ARGS__) |
#define PINFO | ( | _fmt, | |
... | |||
) | _FR_LOG_PREFIX_PERROR(L_INFO, _fmt, ## __VA_ARGS__) |
#define PWARN | ( | _fmt, | |
... | |||
) | _FR_LOG_PREFIX_PERROR(L_WARN, _fmt, ## __VA_ARGS__) |
#define RATE_LIMIT_GLOBAL | ( | _log, | |
_fmt, | |||
... | |||
) |
Rate limit messages using a global limiting entry.
Rate limit log messages so they're written a maximum of once per second.
[in] | _log | Logging macro. |
[in] | _fmt | printf style format string. |
[in] | ... | printf arguments. |
#define RATE_LIMIT_GLOBAL_ROPTIONAL | ( | _l_request, | |
_l_global, | |||
_fmt, | |||
... | |||
) |
Rate limit messages using a global limiting entry.
Rate limit log messages so they're written a maximum of once per second.
[in] | _l_request | The name of a R* logging macro e.g. RDEBUG3. |
[in] | _l_global | The name of a global logging macro e.g. DEBUG3. |
[in] | _fmt | printf style format string. |
[in] | ... | printf arguments. |
#define RATE_LIMIT_LOCAL | ( | _entry, | |
_log, | |||
_fmt, | |||
... | |||
) |
Rate limit messages using a local limiting entry.
Rate limit log messages so they're written a maximum of once per second.
[in] | _entry | Used to track rate limiting. |
[in] | _log | Logging macro. |
[in] | _fmt | printf style format string. |
[in] | ... | printf arguments. |
#define RATE_LIMIT_LOCAL_ROPTIONAL | ( | _entry, | |
_l_request, | |||
_l_global, | |||
_fmt, | |||
... | |||
) |
Rate limit messages using a local limiting entry.
Rate limit log messages so they're written a maximum of once per second. The ROPTIOANL variant allows different logging macros to be used based on whether a request is available.
[in] | _entry | Used to track rate limiting. |
[in] | _l_request | The name of a R* logging macro e.g. RDEBUG3. |
[in] | _l_global | The name of a global logging macro e.g. DEBUG3. |
[in] | _fmt | printf style format string. |
[in] | ... | printf arguments. |
#define RDEBUG | ( | fmt, | |
... | |||
) | do { if (request->log.lvl) log_request(L_DBG, L_DBG_LVL_1, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__); } while(0) |
#define RDEBUG2 | ( | fmt, | |
... | |||
) | do { if (request->log.lvl) log_request(L_DBG, L_DBG_LVL_2, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__); } while(0) |
#define RDEBUG3 | ( | fmt, | |
... | |||
) | do { if (request->log.lvl) log_request(L_DBG, L_DBG_LVL_3, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__); } while(0) |
#define RDEBUG4 | ( | fmt, | |
... | |||
) | do { if (request->log.lvl) log_request(L_DBG, L_DBG_LVL_4, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__); } while(0) |
#define RDEBUG_ENABLED log_rdebug_enabled(L_DBG_LVL_1, request) |
#define RDEBUG_ENABLED2 log_rdebug_enabled(L_DBG_LVL_2, request) |
#define RDEBUG_ENABLED3 log_rdebug_enabled(L_DBG_LVL_3, request) |
#define RDEBUG_ENABLED4 log_rdebug_enabled(L_DBG_LVL_4, request) |
#define RDEBUG_ENABLED5 log_rdebug_enabled(L_DBG_LVL_MAX, request) |
#define RDEBUG_ENABLEDX | ( | _x | ) | log_rdebug_enabled(_x, request) |
#define RDMARKER | ( | _str, | |
_marker_idx, | |||
_marker, | |||
... | |||
) | RMARKER(L_DBG, L_DBG_LVL_1, _str, _marker_idx, _marker, ## __VA_ARGS__) |
Output string with error marker, showing where format error occurred.
These are logged as RDEBUG messages.
my pet kitty ^ kitties are not pets, are nature devouring hell beasts
[in] | _str | to mark e.g. "my pet kitty". |
[in] | _marker_idx | index e.g. 3 (starts from 0). |
[in] | _marker | error message e.g. "kitties are not pets, are nature devouring hell beasts". |
[in] | ... | arguments for error string. |
#define REDEBUG | ( | fmt, | |
... | |||
) | log_request_error(L_DBG_ERR, L_DBG_LVL_1, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__) |
#define REDEBUG2 | ( | fmt, | |
... | |||
) | log_request_error(L_DBG_ERR, L_DBG_LVL_2, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__) |
#define REDEBUG3 | ( | fmt, | |
... | |||
) | log_request_error(L_DBG_ERR, L_DBG_LVL_3,request, __FILE__, __LINE__, fmt, ## __VA_ARGS__) |
#define REDEBUG4 | ( | fmt, | |
... | |||
) | log_request_error(L_DBG_ERR, L_DBG_LVL_MAX, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__) |
#define REMARKER | ( | _str, | |
_marker_idx, | |||
_marker, | |||
... | |||
) | RMARKER(L_DBG_ERR, L_DBG_LVL_1, _str, _marker_idx, _marker, ## __VA_ARGS__) |
Output string with error marker, showing where format error occurred.
These are logged as RERROR messages.
my pet kitty ^ kitties are not pets, are nature devouring hell beasts
[in] | _str | to mark e.g. "my pet kitty". |
[in] | _marker_idx | index e.g. 3 (starts from 0). |
[in] | _marker | error message e.g. "kitties are not pets, are nature devouring hell beasts". |
[in] | ... | arguments for error string. |
#define RERROR | ( | fmt, | |
... | |||
) | log_request_error(L_DBG_ERR, L_DBG_LVL_OFF, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__) |
#define REXDENT | ( | ) |
Exdent (unindent) R* messages by one level.
#define RHEXDUMP1 | ( | _data, | |
_len, | |||
_fmt, | |||
... | |||
) | _RHEXDUMP(L_DBG_LVL_1, _data, _len, _fmt, ## __VA_ARGS__) |
#define RHEXDUMP2 | ( | _data, | |
_len, | |||
_fmt, | |||
... | |||
) | _RHEXDUMP(L_DBG_LVL_2, _data, _len, _fmt, ## __VA_ARGS__) |
#define RHEXDUMP3 | ( | _data, | |
_len, | |||
_fmt, | |||
... | |||
) | _RHEXDUMP(L_DBG_LVL_3, _data, _len, _fmt, ## __VA_ARGS__) |
#define RHEXDUMP4 | ( | _data, | |
_len, | |||
_fmt, | |||
... | |||
) | _RHEXDUMP(L_DBG_LVL_4, _data, _len, _fmt, ## __VA_ARGS__) |
#define RHEXDUMP_INLINE1 | ( | _data, | |
_len, | |||
_fmt, | |||
... | |||
) | _RHEXDUMP_INLINE(L_DBG_LVL_1, _data, _len, _fmt, ## __VA_ARGS__) |
#define RHEXDUMP_INLINE2 | ( | _data, | |
_len, | |||
_fmt, | |||
... | |||
) | _RHEXDUMP_INLINE(L_DBG_LVL_2, _data, _len, _fmt, ## __VA_ARGS__) |
#define RHEXDUMP_INLINE3 | ( | _data, | |
_len, | |||
_fmt, | |||
... | |||
) | _RHEXDUMP_INLINE(L_DBG_LVL_3, _data, _len, _fmt, ## __VA_ARGS__) |
#define RHEXDUMP_INLINE4 | ( | _data, | |
_len, | |||
_fmt, | |||
... | |||
) | _RHEXDUMP_INLINE(L_DBG_LVL_4, _data, _len, _fmt, ## __VA_ARGS__) |
#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) |
#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) |
#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) |
#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) |
#define RINDENT | ( | ) |
Indent R* messages by one level.
#define RINDENT_RESTORE | ( | _request, | |
_x | |||
) |
#define RINDENT_SAVE | ( | _x, | |
_request | |||
) |
#define RINFO | ( | fmt, | |
... | |||
) | log_request(L_INFO, L_DBG_LVL_OFF, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__) |
#define RMARKER | ( | _type, | |
_lvl, | |||
_str, | |||
_marker_idx, | |||
_marker, | |||
... | |||
) |
Output string with error marker, showing where format error occurred.
my pet kitty ^ kitties are not pets, are nature devouring hell beasts
[in] | _type | log category, a fr_log_type_t value. |
[in] | _lvl | log priority, a fr_log_lvl_t value. |
[in] | _str | to mark e.g. "my pet kitty". |
[in] | _marker_idx | index e.g. 3 (starts from 0). |
[in] | _marker | error message e.g. "kitties are not pets, are nature devouring hell beasts". |
[in] | ... | arguments for error string. |
#define ROPTIONAL | ( | _l_request, | |
_l_global, | |||
_fmt, | |||
... | |||
) |
Use different logging functions depending on whether request is NULL or not.
This is useful for areas of code which are run on server startup, and when processing requests.
[in] | _l_request | The name of a R* logging macro e.g. RDEBUG3. |
[in] | _l_global | The name of a global logging macro e.g. DEBUG3. |
[in] | _fmt | printf style format string. |
[in] | ... | printf arguments. |
#define ROPTIONAL_ENABLED | ( | _e_request, | |
_e_global | |||
) | ((request && _e_request) || _e_global) |
#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) |
#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) |
#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) |
#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) |
#define RPEDEBUG | ( | fmt, | |
... | |||
) | log_request_perror(L_DBG_ERR, L_DBG_LVL_1, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__) |
#define RPEDEBUG2 | ( | fmt, | |
... | |||
) | log_request_perror(L_DBG_ERR, L_DBG_LVL_2, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__) |
#define RPEDEBUG3 | ( | fmt, | |
... | |||
) | log_request_perror(L_DBG_ERR, L_DBG_LVL_3, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__) |
#define RPEDEBUG4 | ( | fmt, | |
... | |||
) | log_request_perror(L_DBG_ERR, L_DBG_LVL_MAX, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__) |
#define RPERROR | ( | fmt, | |
... | |||
) | log_request_perror(L_DBG_ERR, L_DBG_LVL_OFF, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__) |
#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) |
#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) |
#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) |
#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) |
#define RPINFO | ( | fmt, | |
... | |||
) | log_request_perror(L_DBG_INFO, L_DBG_LVL_OFF, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__) |
#define RPWARN | ( | fmt, | |
... | |||
) | log_request_perror(L_DBG_WARN, L_DBG_LVL_OFF, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__) |
#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) |
#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) |
#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) |
#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) |
#define RWARN | ( | fmt, | |
... | |||
) | log_request(L_DBG_WARN, L_DBG_LVL_OFF, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__) |
#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) |
#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) |
#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) |
#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) |
#define WARN | ( | _fmt, | |
... | |||
) | _FR_LOG_PREFIX(L_WARN, _fmt, ## __VA_ARGS__) |
#define WMARKER | ( | _str, | |
_marker_idx, | |||
_marker | |||
) | _FR_LOG_PREFIX_MARKER(L_WARN, _str, SIZE_MAX, _marker_idx, _marker) |
typedef struct cf_section CONF_SECTION |
typedef 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.
This allows the logging destination to be customised on a per request basis.
[in] | type | What type of message this is (error, warn, info, debug). |
[in] | lvl | At what logging level this message should be output. |
[in] | file | src file the log message was generated in. |
[in] | line | number the log message was generated on. |
[in] | request | The current request. |
[in] | fmt | sprintf style fmt string. |
[in] | ap | Arguments for the fmt string. |
[in] | uctx | Context data for the log function. Usually an fr_log_t for vlog_request. |
typedef 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,...) |
fr_log_t* log_dst_by_name | ( | char const * | name | ) |
void log_fatal | ( | fr_log_t const * | log, |
char const * | file, | ||
int | line, | ||
char const * | fmt, | ||
... | |||
) |
void log_global_free | ( | void | ) |
Initialises the server logging functionality, and the underlying libfreeradius log.
[in] | log | Logging parameters. |
[in] | daemonize | Changes what we do with stdout/stderr. |
Definition at line 1267 of file log.c.
int log_parse_section | ( | CONF_SECTION * | cs | ) |
Parse a named logging section.
This should probably be done with a FILE*, and L_DST_FUNC.
Definition at line 1132 of file log.c.
|
inline |
Whether a request specific debug message should be logged.
lvl | of debugging this message should be logged at. |
request | The current request. |
Definition at line 267 of file log.c.
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.
[in] | type | the log category. |
[in] | lvl | of debugging this message should be logged at. |
[in] | request | The current request. |
[in] | file | src file the log message was generated in. |
[in] | line | number the log message was generated on. |
[in] | fmt | with printf style substitution tokens. |
[in] | ... | Substitution arguments. |
Definition at line 612 of file log.c.
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.
This could all be done in a macro, but it turns out some implementations of the variadic macros do not work at all well if the va_list being written to is further up the stack (which is required as you still need a function to convert the ellipsis into a va_list).
So, we use this small wrapper function instead, which will hopefully guarantee consistent behaviour.
[in] | type | the log category. |
[in] | lvl | of debugging this message should be logged at. |
[in] | request | The current request. |
[in] | file | src file the log message was generated in. |
[in] | line | number the log message was generated on. |
[in] | fmt | with printf style substitution tokens. |
[in] | ... | Substitution arguments. |
Definition at line 647 of file log.c.
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.
Writes any data read from a file descriptor to the request log, tries very hard not to chop lines in the middle, but will split at 1024 byte boundaries if forced to.
[in] | el | UNUSED |
[in] | fd | UNUSED |
[in] | flags | UNUSED |
[in] | uctx | Pointer to a log_fd_event_ctx_t |
Definition at line 956 of file log.c.
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 | ||
) |
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_fmt, | ||
... | |||
) |
Write the string being parsed, and a marker showing where the parse error occurred.
[in] | type | the log category. |
[in] | lvl | of debugging this message should be logged at. |
[in] | request | The current request. |
[in] | file | src file the log message was generated in. |
[in] | line | number the log message was generated on. |
[in] | str | Subject string we're printing a marker for. |
[in] | str_len | Subject string length. Use SIZE_MAX for the length of the string. |
[in] | marker_idx | The position of the marker relative to the string. |
[in] | marker_fmt | What the parse error was. |
[in] | ... | Arguments for fmt string. |
Definition at line 886 of file log.c.
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 | ||
) |
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.
[in] | lvl | Debug lvl (1-4). |
[in] | request | to read logging params from. |
[in] | parent | of vps to print, may be NULL. |
[in] | vps | to print. |
[in] | prefix | (optional). |
Definition at line 830 of file log.c.
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.
This function drains any messages from fr_strerror buffer adding a prefix (fmt) to the first message.
[in] | type | the log category. |
[in] | lvl | of debugging this message should be logged at. |
[in] | request | The current request. |
[in] | file | src file the log message was generated in. |
[in] | line | number the log message was generated on. |
[in] | fmt | with printf style substitution tokens. |
[in] | ... | Substitution arguments. |
Definition at line 679 of file log.c.
void log_request_proto_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 list of protocol fr_pair_ts.
[in] | lvl | Debug lvl (1-4). |
[in] | request | to read logging params from. |
[in] | parent | of vps to print, may be NULL. |
[in] | vps | to print. |
[in] | prefix | (optional). |
Definition at line 854 of file log.c.
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.
[in] | type | of log message, L_ERR, L_WARN, L_INFO, L_DBG. |
[in] | lvl | Minimum required server or request level to output this message. |
[in] | request | The current request. |
[in] | file | src file the log message was generated in. |
[in] | line | number the log message was generated on. |
[in] | fmt | with printf style substitution tokens. |
[in] | ap | Substitution arguments. |
[in] | uctx | The fr_log_t specifying the destination for log messages. |
Definition at line 295 of file log.c.
|
extern |
|
extern |
|
extern |