25 RCSID(
"$Id: 43a2fa5c1478a22af7386fe691d4a5f177de3ff1 $")
27 #define LOG_PREFIX "unbound"
29 #include <freeradius-devel/util/syserror.h>
44 if (len == 0)
return len;
45 if (buf[len - 1] ==
'\n') len--;
90 ret = ub_ctx_debuglevel(ub, level);
92 ERROR(
"Failed setting unbound log level to %i", level);
140 ret = ub_ctx_get_option(ub,
"use-syslog", &val);
141 if ((ret != 0) || !val) {
142 ERROR(
"Failed retrieving unbound syslog settings: %s", ub_strerror(ret));
146 if (strcmp(val,
"yes") == 0) {
147 WARN(
"Disabling unbound syslog output (use-syslog: %s) > (use-syslog: no)", val);
149 ret = ub_ctx_set_option(ub,
"use-syslog:",
"no");
151 ERROR(
"Failed disabling unbound syslog output: %s", ub_strerror(ret));
158 ret = ub_ctx_get_option(ub,
"logfile", &val);
159 if ((ret != 0) || !val) {
160 ERROR(
"Failed retrieving unbound logfile settings: %s", ub_strerror(ret));
164 if (strcmp(val,
"yes") == 0) {
165 WARN(
"Disabling unbound logfile output (logfile: %s) > (logfile: no)", val);
167 ret = ub_ctx_set_option(ub,
"logfile:",
"no");
169 ERROR(
"Failed disabling unbound logfile output: %s", ub_strerror(ret));
190 setlinebuf(u_log->
stream);
192 ret = ub_ctx_debugout(ub, u_log->
stream);
194 ERROR(
"Failed setting log stream for unbound: %s", ub_strerror(ret));
FILE * fopencookie(void *cookie, const char *mode, cookie_io_functions_t io_funcs)
#define ROPTIONAL(_l_request, _l_global, _fmt,...)
Use different logging functions depending on whether request is NULL or not.
@ L_DBG_LVL_3
3rd highest priority debug messages (-xxx | -Xx).
@ L_DBG_LVL_1
Highest priority debug messages (-x).
@ L_DBG_LVL_DISABLE
Don't print messages.
@ L_DBG_LVL_2
2nd highest priority debug messages (-xx | -X).
@ L_DBG_LVL_OFF
No debug messages.
@ L_DBG_LVL_4
4th highest priority debug messages (-xxxx | -Xxx).
@ L_DBG_LVL_MAX
Lowest priority debug messages (-xxxxx | -Xxxx).
int unbound_log_to_global(unbound_log_t *u_log, struct ub_ctx *ub)
Switch thread-specific libunbound output to the global log.
static ssize_t _unbound_log_write(void *cookie, char const *buf, size_t size)
Write libunbound output to the server or request log.
static int _unbound_log_free(unbound_log_t *u_log)
static int unbound_log_lvl_set(struct ub_ctx *ub, fr_log_lvl_t lvl)
Set the debug level for a ub_ctx from the request or global debug level.
int unbound_log_to_request(unbound_log_t *u_log, struct ub_ctx *ub, request_t *request)
Switch thread-specific libunbound output to the request log destination(s)
int unbound_log_init(TALLOC_CTX *ctx, unbound_log_t **u_log_out, struct ub_ctx *ub)
Setup an unbound context for log, and initialise a u_log struct.
Function prototypes and datatypes for the REST (HTTP) transport.
request_t * request
Request we're logging to.
FILE * stream
Stream we use to interface with the FreeRADIUS logging functions.
MEM(pair_append_request(&vp, attr_eap_aka_sim_identity) >=0)
char const * fr_syserror(int num)
Guaranteed to be thread-safe version of strerror.
#define fr_box_strvalue_len(_val, _len)