All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
log.h File Reference

Macros and function definitions to write log messages, and control the logging system. More...

Go to the source code of this file.

Data Structures

struct  fr_log_t
 

Macros

#define MOD_ROPTIONAL(_l_request, _l_global, fmt,...)
 Use different logging functions depending on whether request is NULL or not. More...
 
#define RATE_LIMIT(_x)
 Rate limit messages. More...
 
#define RATE_LIMIT_ENABLED   rate_limit_enabled()
 True if rate limiting is enabled. More...
 
#define RDMARKER(_m, _i, _e)   RMARKER(L_DBG, L_DBG_LVL_1, _m, _i, _e)
 Output string with error marker, showing where format error occurred. More...
 
#define REMARKER(_m, _i, _e)   RMARKER(L_DBG_ERR, L_DBG_LVL_1, _m, _i, _e)
 Output string with error marker, showing where format error occurred. More...
 
#define REXDENT()   (request->log.indent -= 2)
 Exdent (unindent) R* messages by one level. More...
 
#define RINDENT()   (request->log.indent += 2)
 Indent R* messages by one level. More...
 
#define RMARKER(_l, _p, _m, _i, _e)   radlog_request_marker(_l, _p, request, _m, _i, _e)
 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...
 
Log global messages

Write to the global log.

Messages will always be written irrespective of the debugging level set with -x or -X.

Warning
If a REQUEST * is NOT available, these macros MUST be used.
Note
These macros should only be used for important global events.

Debug categories

Name Syslog severity Colour/style When to use
AUTH LOG_NOTICE Bold Never - Deprecated
ACCT LOG_NOTICE Bold Never - Deprecated
PROXY LOG_NOTICE Bold Never - Deprecated
INFO LOG_INFO Bold TBD
WARN LOG_WARNING Yellow Warnings. Impending resource exhaustion, resource exhaustion
ERROR LOG_ERR Red Critical server errors. Malformed queries, failed operations, connection errors, packet processing errors
#define AUTH(fmt,...)   radlog(L_AUTH, fmt, ## __VA_ARGS__)
 
#define ACCT(fmt,...)   radlog(L_ACCT, fmt, ## __VA_ARGS__)
 
#define PROXY(fmt,...)   radlog(L_PROXY, fmt, ## __VA_ARGS__)
 
#define INFO(fmt,...)   radlog(L_INFO, fmt, ## __VA_ARGS__)
 
#define WARN(fmt,...)   radlog(L_WARN, fmt, ## __VA_ARGS__)
 
#define ERROR(fmt,...)   radlog(L_ERR, fmt, ## __VA_ARGS__)
 
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

Name Syslog severity Colour/style When to use
DEBUG LOG_DEBUG Regular Normal debug output

Debug levels

Level Debug arguments Macro(s) enabled When to use
1 -x DEBUG Never - Deprecated
2 -xx or -X DEBUG, DEBUG2 Interactions with external entities. Connection management, control socket, triggers, etc...
3 -xxx or -Xx DEBUG, DEBUG2, DEBUG3 Lower priority events. Polling for detail files, cleanups, etc...
4 -xxxx or -Xxx DEBUG, DEBUG2, DEBUG3, DEBUG4 Internal server state debugging.
#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_MAX)
 True if global debug level 1-4 messages are enabled. More...
 
#define _SL(_l, _p, _f,...)   if (rad_debug_lvl >= _p) radlog(_l, _f, ## __VA_ARGS__)
 
#define DEBUG(fmt,...)   _SL(L_DBG, L_DBG_LVL_1, fmt, ## __VA_ARGS__)
 
#define DEBUG2(fmt,...)   _SL(L_DBG, L_DBG_LVL_2, fmt, ## __VA_ARGS__)
 
#define DEBUG3(fmt,...)   _SL(L_DBG, L_DBG_LVL_3, fmt, ## __VA_ARGS__)
 
#define DEBUG4(fmt,...)   _SL(L_DBG, L_DBG_LVL_MAX, 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 -x or -X.

Note
Automatically prepends date (at lvl >= 3), request number, and module, to the log message.
If a REQUEST * is available, these macros should be used.
These macros should only be used for important global events.

Debug categories

Name Syslog severity Colour/style When to use
RAUTH LOG_NOTICE Bold Never - Deprecated
RACCT LOG_NOTICE Bold Never - Deprecated
RPROXY LOG_NOTICE Bold Never - Deprecated
RINFO LOG_INFO Bold TBD
RWARN LOG_WARNING Yellow/Bold Warnings. Impending resource exhaustion, or resource exhaustion.
RERROR LOG_ERR Red/Bold Critical server errors. Malformed queries, failed operations, connection errors, packet processing errors.
#define RAUTH(fmt,...)   radlog_request(L_AUTH, L_DBG_LVL_OFF, request, fmt, ## __VA_ARGS__)
 
#define RACCT(fmt,...)   radlog_request(L_ACCT, L_DBG_LVL_OFF, request, fmt, ## __VA_ARGS__)
 
#define RPROXY(fmt,...)   radlog_request(L_PROXY, L_DBG_LVL_OFF, request, fmt, ## __VA_ARGS__)
 
#define RINFO(fmt,...)   radlog_request(L_INFO, L_DBG_LVL_OFF, request, fmt, ## __VA_ARGS__)
 
#define RWARN(fmt,...)   radlog_request(L_DBG_WARN, L_DBG_LVL_OFF, request, fmt, ## __VA_ARGS__)
 
#define RERROR(fmt,...)   radlog_request_error(L_DBG_ERR, L_DBG_LVL_OFF, request, 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.

Note
Automatically prepends date (at lvl >= 3), request number, and module, to the log message.

Debug categories

Name Syslog severity Colour and style When to use
RDEBUG* LOG_DEBUG Regular Normal debugging messages
RIDEBUG* LOG_DEBUG Bold Informational messages.
RWDEBUG* LOG_DEBUG Yellow/Bold Warnings. Invalid configuration, missing or invalid attributes etc...
REDEBUG* LOG_DEBUG Red/Bold Errors. Reject messages, bad values etc...

Debug levels

Level Debug arguments Macro(s) enabled When to use
1 -x R*DEBUG Never - Deprecated
2 -xx or -X R*DEBUG, R*DEBUG2 Normal request flow. Operations, Results of queries, or execs, etc...
3 -xxx or -Xx R*DEBUG, R*DEBUG2, R*DEBUG3 Internal server state or packet input. State machine changes, extra attribute info, etc...
4 -xxxx or -Xxx R*DEBUG, R*DEBUG2, R*DEBUG3, R*DEBUG4 Verbose internal server state messages or packet input. Hex dumps, structure dumps, pointer values.
#define RDEBUG_ENABLED   radlog_debug_enabled(L_DBG, L_DBG_LVL_1, request)
 True if request debug level 1 messages are enabled. More...
 
#define RDEBUG_ENABLED2   radlog_debug_enabled(L_DBG, L_DBG_LVL_2, request)
 True if request debug level 1-2 messages are enabled. More...
 
#define RDEBUG_ENABLED3   radlog_debug_enabled(L_DBG, L_DBG_LVL_3, request)
 True if request debug level 1-3 messages are enabled. More...
 
#define RDEBUG_ENABLED4   radlog_debug_enabled(L_DBG, L_DBG_LVL_MAX, request)
 True if request debug level 1-4 messages are enabled. More...
 
#define RDEBUGX(_l, fmt,...)   radlog_request(L_DBG, _l, request, fmt, ## __VA_ARGS__)
 
#define RDEBUG(fmt,...)   if (rad_debug_lvl || request->log.lvl) radlog_request(L_DBG, L_DBG_LVL_1, request, fmt, ## __VA_ARGS__)
 
#define RDEBUG2(fmt,...)   if (rad_debug_lvl || request->log.lvl) radlog_request(L_DBG, L_DBG_LVL_2, request, fmt, ## __VA_ARGS__)
 
#define RDEBUG3(fmt,...)   if (rad_debug_lvl || request->log.lvl) radlog_request(L_DBG, L_DBG_LVL_3, request, fmt, ## __VA_ARGS__)
 
#define RDEBUG4(fmt,...)   if (rad_debug_lvl || request->log.lvl) radlog_request(L_DBG, L_DBG_LVL_MAX, request, fmt, ## __VA_ARGS__)
 
#define RIDEBUG(fmt,...)   radlog_request(L_INFO, L_DBG_LVL_1, request, fmt, ## __VA_ARGS__)
 
#define RIDEBUG2(fmt,...)   radlog_request(L_INFO, L_DBG_LVL_2, request, fmt, ## __VA_ARGS__)
 
#define RWDEBUG(fmt,...)   if (rad_debug_lvl || request->log.lvl) radlog_request(L_DBG_WARN, L_DBG_LVL_1, request, fmt, ## __VA_ARGS__)
 
#define RWDEBUG2(fmt,...)   if (rad_debug_lvl || request->log.lvl) radlog_request(L_DBG_WARN, L_DBG_LVL_2, request, fmt, ## __VA_ARGS__)
 
#define REDEBUG(fmt,...)   radlog_request_error(L_DBG_ERR, L_DBG_LVL_1, request, fmt, ## __VA_ARGS__)
 
#define REDEBUG2(fmt,...)   radlog_request_error(L_DBG_ERR, L_DBG_LVL_2, request, fmt, ## __VA_ARGS__)
 
#define REDEBUG3(fmt,...)   radlog_request_error(L_DBG_ERR, L_DBG_LVL_3, request, fmt, ## __VA_ARGS__)
 
#define REDEBUG4(fmt,...)   radlog_request_error(L_DBG_ERR, L_DBG_LVL_MAX, request, fmt, ## __VA_ARGS__)
 

Typedefs

typedef struct fr_log_t fr_log_t
 
typedef enum log_dst log_dst_t
 
typedef enum log_lvl log_lvl_t
 
typedef enum log_type log_type_t
 
typedef void(* radlog_func_t )(log_type_t lvl, log_lvl_t priority, REQUEST *, char const *, va_list ap)
 

Enumerations

enum  log_dst {
  L_DST_STDOUT = 0,
  L_DST_FILES,
  L_DST_SYSLOG,
  L_DST_STDERR,
  L_DST_EXTRA,
  L_DST_NULL,
  L_DST_NUM_DEST
}
 
enum  log_lvl {
  L_DBG_LVL_DISABLE = -1,
  L_DBG_LVL_OFF = 0,
  L_DBG_LVL_1,
  L_DBG_LVL_2,
  L_DBG_LVL_3,
  L_DBG_LVL_MAX
}
 
enum  log_type {
  L_AUTH = 2,
  L_INFO = 3,
  L_ERR = 4,
  L_WARN = 5,
  L_PROXY = 6,
  L_ACCT = 7,
  L_DBG = 16,
  L_DBG_WARN = 17,
  L_DBG_ERR = 18,
  L_DBG_WARN_REQ = 19,
  L_DBG_ERR_REQ = 20
}
 

Functions

int CC_HINT (nonnull)
 
int CC_HINT (nonnull(2))
 
void CC_HINT (nonnull(3, 4))
 
bool debug_enabled (log_type_t type, log_lvl_t lvl)
 Whether a server debug message should be logged. More...
 
int radlog (log_type_t lvl, char const *fmt,...) CC_HINT(format(printf
 
bool radlog_debug_enabled (log_type_t type, log_lvl_t lvl, REQUEST *request) CC_HINT(nonnull)
 Whether a request specific debug message should be logged. More...
 
int radlog_init (fr_log_t *log, bool daemonize)
 Initialise file descriptors based on logging destination. More...
 
void radlog_request (log_type_t type, log_lvl_t lvl, REQUEST *request, char const *msg,...) CC_HINT(format(printf
 
void radlog_request_error (log_type_t type, log_lvl_t lvl, REQUEST *request, char const *msg,...) CC_HINT(format(printf
 
void radlog_request_marker (log_type_t type, log_lvl_t lvl, REQUEST *request, char const *fmt, size_t indent, char const *error) CC_HINT(nonnull)
 Write the string being parsed, and a marker showing where the parse error occurred. More...
 
bool rate_limit_enabled (void)
 Whether rate limiting is enabled. More...
 
int vradlog (log_type_t lvl, char const *fmt, va_list ap) CC_HINT(format(printf
 
void vradlog_request (log_type_t type, log_lvl_t lvl, REQUEST *request, char const *msg, va_list ap) CC_HINT(format(printf
 

Variables

fr_log_t default_log
 
FR_NAME_NUMBER const log_str2dst []
 
FR_NAME_NUMBER const syslog_facility_table []
 Syslog facility table. More...
 
FR_NAME_NUMBER const syslog_severity_table []
 Syslog severity table. More...
 

Detailed Description

Macros and function definitions to write log messages, and control the logging system.

Id:
c9a07594a86c959d99248e1ad74d6b5a68cb8d3a

Definition in file log.h.

Macro Definition Documentation

#define _SL (   _l,
  _p,
  _f,
  ... 
)    if (rad_debug_lvl >= _p) radlog(_l, _f, ## __VA_ARGS__)

Definition at line 174 of file log.h.

#define ACCT (   fmt,
  ... 
)    radlog(L_ACCT, fmt, ## __VA_ARGS__)

Definition at line 140 of file log.h.

#define AUTH (   fmt,
  ... 
)    radlog(L_AUTH, fmt, ## __VA_ARGS__)

Definition at line 139 of file log.h.

#define DEBUG (   fmt,
  ... 
)    _SL(L_DBG, L_DBG_LVL_1, fmt, ## __VA_ARGS__)

Definition at line 175 of file log.h.

#define DEBUG2 (   fmt,
  ... 
)    _SL(L_DBG, L_DBG_LVL_2, fmt, ## __VA_ARGS__)

Definition at line 176 of file log.h.

#define DEBUG3 (   fmt,
  ... 
)    _SL(L_DBG, L_DBG_LVL_3, fmt, ## __VA_ARGS__)

Definition at line 177 of file log.h.

#define DEBUG4 (   fmt,
  ... 
)    _SL(L_DBG, L_DBG_LVL_MAX, fmt, ## __VA_ARGS__)

Definition at line 178 of file log.h.

#define DEBUG_ENABLED   debug_enabled(L_DBG, L_DBG_LVL_1)

True if global debug level 1 messages are enabled.

Definition at line 169 of file log.h.

#define DEBUG_ENABLED2   debug_enabled(L_DBG, L_DBG_LVL_2)

True if global debug level 1-2 messages are enabled.

Definition at line 170 of file log.h.

#define DEBUG_ENABLED3   debug_enabled(L_DBG, L_DBG_LVL_3)

True if global debug level 1-3 messages are enabled.

Definition at line 171 of file log.h.

#define DEBUG_ENABLED4   debug_enabled(L_DBG, L_DBG_LVL_MAX)

True if global debug level 1-4 messages are enabled.

Definition at line 172 of file log.h.

#define ERROR (   fmt,
  ... 
)    radlog(L_ERR, fmt, ## __VA_ARGS__)

Definition at line 145 of file log.h.

#define INFO (   fmt,
  ... 
)    radlog(L_INFO, fmt, ## __VA_ARGS__)

Definition at line 143 of file log.h.

#define MOD_ROPTIONAL (   _l_request,
  _l_global,
  fmt,
  ... 
)
Value:
do {\
if (request) {\
_l_request(fmt, ## __VA_ARGS__);\
} else {\
_l_global(MOD_PREFIX " (%s): " fmt, inst->name, ## __VA_ARGS__);\
}\
} while (0)
#define MOD_PREFIX
The name of the module.
Definition: ldap.h:103
#define inst

Use different logging functions depending on whether request is NULL or not.

Note
The module must define MOD_PREFIX as its name (do this in the module header file) e.g.
#define MOD_PREFIX "rlm_example"

This is useful for areas of code which are run on server startup, and when processing requests.

Parameters
_l_requestThe name of a R* logging macro e.g. RDEBUG3.
_l_globalThe name of a global logging macro e.g. DEBUG3.
fmtprintf style format string.
...printf arguments.

Definition at line 338 of file log.h.

#define PROXY (   fmt,
  ... 
)    radlog(L_PROXY, fmt, ## __VA_ARGS__)

Definition at line 141 of file log.h.

#define RACCT (   fmt,
  ... 
)    radlog_request(L_ACCT, L_DBG_LVL_OFF, request, fmt, ## __VA_ARGS__)

Definition at line 203 of file log.h.

#define RATE_LIMIT (   _x)
Value:
do {\
static time_t _last_complained = 0;\
time_t _now = time(NULL);\
if (_now != _last_complained) {\
_last_complained = _now;\
_x;\
}\
} else _x;\
} while (0)
#define RATE_LIMIT_ENABLED
True if rate limiting is enabled.
Definition: log.h:366

Rate limit messages.

Rate limit log messages so they're written a maximum of once per second.

RATE_LIMIT(RERROR("Home servers alive in pool %s", pool->name));
Note
Rate limits the macro, not the message. If five different messages are produced using the same macro in the same second, only the first will be written to the log.
Parameters
_xLogging macro to limit.

Definition at line 380 of file log.h.

#define RATE_LIMIT_ENABLED   rate_limit_enabled()

True if rate limiting is enabled.

Definition at line 366 of file log.h.

#define RAUTH (   fmt,
  ... 
)    radlog_request(L_AUTH, L_DBG_LVL_OFF, request, fmt, ## __VA_ARGS__)

Definition at line 202 of file log.h.

#define RDEBUG (   fmt,
  ... 
)    if (rad_debug_lvl || request->log.lvl) radlog_request(L_DBG, L_DBG_LVL_1, request, fmt, ## __VA_ARGS__)

Definition at line 243 of file log.h.

#define RDEBUG2 (   fmt,
  ... 
)    if (rad_debug_lvl || request->log.lvl) radlog_request(L_DBG, L_DBG_LVL_2, request, fmt, ## __VA_ARGS__)

Definition at line 244 of file log.h.

#define RDEBUG3 (   fmt,
  ... 
)    if (rad_debug_lvl || request->log.lvl) radlog_request(L_DBG, L_DBG_LVL_3, request, fmt, ## __VA_ARGS__)

Definition at line 245 of file log.h.

#define RDEBUG4 (   fmt,
  ... 
)    if (rad_debug_lvl || request->log.lvl) radlog_request(L_DBG, L_DBG_LVL_MAX, request, fmt, ## __VA_ARGS__)

Definition at line 246 of file log.h.

#define RDEBUG_ENABLED   radlog_debug_enabled(L_DBG, L_DBG_LVL_1, request)

True if request debug level 1 messages are enabled.

Definition at line 237 of file log.h.

#define RDEBUG_ENABLED2   radlog_debug_enabled(L_DBG, L_DBG_LVL_2, request)

True if request debug level 1-2 messages are enabled.

Definition at line 238 of file log.h.

#define RDEBUG_ENABLED3   radlog_debug_enabled(L_DBG, L_DBG_LVL_3, request)

True if request debug level 1-3 messages are enabled.

Definition at line 239 of file log.h.

#define RDEBUG_ENABLED4   radlog_debug_enabled(L_DBG, L_DBG_LVL_MAX, request)

True if request debug level 1-4 messages are enabled.

Definition at line 240 of file log.h.

#define RDEBUGX (   _l,
  fmt,
  ... 
)    radlog_request(L_DBG, _l, request, fmt, ## __VA_ARGS__)

Definition at line 242 of file log.h.

#define RDMARKER (   _m,
  _i,
  _e 
)    RMARKER(L_DBG, L_DBG_LVL_1, _m, _i, _e)

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
Warning
If a REQUEST * is NOT available, or is NULL, this macro must NOT be used.
Parameters
_mstring to mark e.g. "my pet kitty".
_iindex e.g. 3 (starts from 0).
_eerror e.g. "kitties are not pets, are nature devouring hell beasts".

Definition at line 323 of file log.h.

#define REDEBUG (   fmt,
  ... 
)    radlog_request_error(L_DBG_ERR, L_DBG_LVL_1, request, fmt, ## __VA_ARGS__)

Definition at line 254 of file log.h.

#define REDEBUG2 (   fmt,
  ... 
)    radlog_request_error(L_DBG_ERR, L_DBG_LVL_2, request, fmt, ## __VA_ARGS__)

Definition at line 255 of file log.h.

#define REDEBUG3 (   fmt,
  ... 
)    radlog_request_error(L_DBG_ERR, L_DBG_LVL_3, request, fmt, ## __VA_ARGS__)

Definition at line 256 of file log.h.

#define REDEBUG4 (   fmt,
  ... 
)    radlog_request_error(L_DBG_ERR, L_DBG_LVL_MAX, request, fmt, ## __VA_ARGS__)

Definition at line 257 of file log.h.

#define REMARKER (   _m,
  _i,
  _e 
)    RMARKER(L_DBG_ERR, L_DBG_LVL_1, _m, _i, _e)

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
Warning
If a REQUEST * is NOT available, or is NULL, this macro must NOT be used.
Parameters
_mstring to mark e.g. "my pet kitty".
_iindex e.g. 3 (starts from 0).
_eerror e.g. "kitties are not pets, are nature devouring hell beasts".

Definition at line 306 of file log.h.

#define RERROR (   fmt,
  ... 
)    radlog_request_error(L_DBG_ERR, L_DBG_LVL_OFF, request, fmt, ## __VA_ARGS__)

Definition at line 207 of file log.h.

#define REXDENT ( )    (request->log.indent -= 2)

Exdent (unindent) R* messages by one level.

Note
Has no effect on the indentation of INFO, WARN, ERROR, DEBUG messages, only RINFO, RWARN, RERROR etc...

Definition at line 272 of file log.h.

#define RIDEBUG (   fmt,
  ... 
)    radlog_request(L_INFO, L_DBG_LVL_1, request, fmt, ## __VA_ARGS__)

Definition at line 248 of file log.h.

#define RIDEBUG2 (   fmt,
  ... 
)    radlog_request(L_INFO, L_DBG_LVL_2, request, fmt, ## __VA_ARGS__)

Definition at line 249 of file log.h.

#define RINDENT ( )    (request->log.indent += 2)

Indent R* messages by one level.

Note
Has no effect on the indentation of INFO, WARN, ERROR, DEBUG messages, only RINFO, RWARN, RERROR etc...

Definition at line 265 of file log.h.

#define RINFO (   fmt,
  ... 
)    radlog_request(L_INFO, L_DBG_LVL_OFF, request, fmt, ## __VA_ARGS__)

Definition at line 205 of file log.h.

#define RMARKER (   _l,
  _p,
  _m,
  _i,
  _e 
)    radlog_request_marker(_l, _p, request, _m, _i, _e)

Output string with error marker, showing where format error occurred.

  my pet kitty
     ^ kitties are not pets, are nature devouring hell beasts
Warning
If a REQUEST * is NOT available, or is NULL, this macro must NOT be used.
Parameters
_llog category, a log_type_t value.
_plog priority, a log_lvl_t value.
_mstring to mark e.g. "my pet kitty".
_iindex e.g. 3 (starts from 0).
_eerror e.g. "kitties are not pets, are nature devouring hell beasts".

Definition at line 289 of file log.h.

#define ROPTIONAL (   _l_request,
  _l_global,
  fmt,
  ... 
)
Value:
do {\
if (request) {\
_l_request(fmt, ## __VA_ARGS__);\
} else {\
_l_global(LOG_PREFIX ": " fmt, ## __VA_ARGS__);\
}\
} while (0)
#define LOG_PREFIX
Definition: eap.h:37

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.

Parameters
_l_requestThe name of a R* logging macro e.g. RDEBUG3.
_l_globalThe name of a global logging macro e.g. DEBUG3.
fmtprintf style format string.
...printf arguments.

Definition at line 357 of file log.h.

#define RPROXY (   fmt,
  ... 
)    radlog_request(L_PROXY, L_DBG_LVL_OFF, request, fmt, ## __VA_ARGS__)

Definition at line 204 of file log.h.

#define RWARN (   fmt,
  ... 
)    radlog_request(L_DBG_WARN, L_DBG_LVL_OFF, request, fmt, ## __VA_ARGS__)

Definition at line 206 of file log.h.

#define RWDEBUG (   fmt,
  ... 
)    if (rad_debug_lvl || request->log.lvl) radlog_request(L_DBG_WARN, L_DBG_LVL_1, request, fmt, ## __VA_ARGS__)

Definition at line 251 of file log.h.

#define RWDEBUG2 (   fmt,
  ... 
)    if (rad_debug_lvl || request->log.lvl) radlog_request(L_DBG_WARN, L_DBG_LVL_2, request, fmt, ## __VA_ARGS__)

Definition at line 252 of file log.h.

#define WARN (   fmt,
  ... 
)    radlog(L_WARN, fmt, ## __VA_ARGS__)

Definition at line 144 of file log.h.

Typedef Documentation

typedef struct fr_log_t fr_log_t
typedef enum log_dst log_dst_t
typedef enum log_lvl log_lvl_t
typedef enum log_type log_type_t
typedef void(* radlog_func_t)(log_type_t lvl, log_lvl_t priority, REQUEST *, char const *, va_list ap)

Definition at line 83 of file log.h.

Enumeration Type Documentation

enum log_dst
Enumerator
L_DST_STDOUT 

Log to stdout.

L_DST_FILES 

Log to a file on disk.

L_DST_SYSLOG 

Log to syslog.

L_DST_STDERR 

Log to stderr.

L_DST_EXTRA 

Send log messages to a FILE*, via fopencookie()

L_DST_NULL 

Discard log messages.

L_DST_NUM_DEST 

Definition at line 57 of file log.h.

enum log_lvl
Enumerator
L_DBG_LVL_DISABLE 

Don't print messages.

L_DBG_LVL_OFF 

No debug messages.

L_DBG_LVL_1 

Highest priority debug messages (-x).

L_DBG_LVL_2 

2nd highest priority debug messages (-xx | -X).

L_DBG_LVL_3 

3rd highest priority debug messages (-xxx | -Xx).

L_DBG_LVL_MAX 

Lowest priority debug messages (-xxxx | -Xxx).

Definition at line 48 of file log.h.

enum log_type
Enumerator
L_AUTH 

Authentication message.

L_INFO 

Informational message.

L_ERR 

Error message.

L_WARN 

Warning.

L_PROXY 

Proxy messages.

L_ACCT 

Accounting messages.

L_DBG 

Only displayed when debugging is enabled.

L_DBG_WARN 

Warning only displayed when debugging is enabled.

L_DBG_ERR 

Error only displayed when debugging is enabled.

L_DBG_WARN_REQ 

Less severe warning only displayed when debugging is enabled.

L_DBG_ERR_REQ 

Less severe error only displayed when debugging is enabled.

Definition at line 33 of file log.h.

Function Documentation

static rlm_rcode_t CC_HINT ( nonnull  )

< State as hexits

< State timestamp.

< Expected State length.

Definition at line 112 of file rlm_always.c.

+ Here is the call graph for this function:

int CC_HINT ( nonnull(2)  )
void CC_HINT ( nonnull(3, 4)  )
bool debug_enabled ( log_type_t  type,
log_lvl_t  lvl 
)
inline

Whether a server debug message should be logged.

Parameters
typeof message.
lvlof debugging this message should be logged at.
Returns
  • true if message should be logged.
  • false if message shouldn't be logged.

Definition at line 579 of file log.c.

int radlog ( log_type_t  lvl,
char const *  fmt,
  ... 
)

+ Here is the caller graph for this function:

bool radlog_debug_enabled ( log_type_t  type,
log_lvl_t  lvl,
REQUEST request 
)
inline

Whether a request specific debug message should be logged.

Parameters
typeof message.
lvlof debugging this message should be logged at.
requestThe current request.
Returns
  • true if message should be logged.
  • false if message shouldn't be logged.

Definition at line 604 of file log.c.

+ Here is the caller graph for this function:

int radlog_init ( fr_log_t log,
bool  daemonize 
)

Initialise file descriptors based on logging destination.

Parameters
logLogger to manipulate.
daemonizeWhether the server is starting as a daemon.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 257 of file log.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void radlog_request ( log_type_t  type,
log_lvl_t  lvl,
REQUEST request,
char const *  msg,
  ... 
)

+ Here is the caller graph for this function:

void radlog_request_error ( log_type_t  type,
log_lvl_t  lvl,
REQUEST request,
char const *  msg,
  ... 
)
void radlog_request_marker ( log_type_t  type,
log_lvl_t  lvl,
REQUEST request,
char const *  msg,
size_t  idx,
char const *  error 
)

Write the string being parsed, and a marker showing where the parse error occurred.

Parameters
typethe log category.
lvlof debugging this message should be logged at.
requestThe current request.
msgstring we were parsing.
idxThe position of the marker relative to the string.
errorWhat the parse error was.

Definition at line 873 of file log.c.

+ Here is the call graph for this function:

bool rate_limit_enabled ( void  )

Whether rate limiting is enabled.

Definition at line 588 of file log.c.

int vradlog ( log_type_t  lvl,
char const *  fmt,
va_list  ap 
)

+ Here is the caller graph for this function:

void vradlog_request ( log_type_t  type,
log_lvl_t  lvl,
REQUEST request,
char const *  msg,
va_list  ap 
)

+ Here is the caller graph for this function:

Variable Documentation

fr_log_t default_log

Definition at line 216 of file log.c.

FR_NAME_NUMBER const log_str2dst[]

Definition at line 205 of file log.c.

FR_NAME_NUMBER const syslog_facility_table[]

Syslog facility table.

Maps syslog facility keywords, to the syslog facility macros defined in the system's syslog.h.

Note
Not all facilities are supported by every operating system. If a facility is unavailable it will not appear in the table.

Definition at line 110 of file log.c.

FR_NAME_NUMBER const syslog_severity_table[]

Syslog severity table.

Maps syslog severity keywords, to the syslog severity macros defined in the system's syslog.h file.

Definition at line 177 of file log.c.