|
unbound
0.1
|
This file contains logging functions. More...
#include <ldns/buffer.h>Defines | |
| #define | log_assert(x) /*nothing*/ |
| an assertion that is thrown to the logfile. | |
Enumerations | |
| enum | verbosity_value { NO_VERBOSE = 0, NO_VERBOSE = 0, VERB_OPS, VERB_DETAIL, VERB_QUERY, VERB_ALGO, VERB_CLIENT } |
| verbosity value: More... | |
Functions | |
| void | verbose (enum verbosity_value level, const char *format,...) ATTR_FORMAT(printf |
| log a verbose message, pass the level for this message. | |
| void void | log_init (const char *filename, int use_syslog, const char *chrootdir) |
| call this to initialize logging services. | |
| void | log_file (FILE *f) |
| Set logging to go to the specified file *. | |
| void | log_thread_set (int *num) |
| Init a thread (will print this number for the thread log entries). | |
| void | log_ident_set (const char *id) |
| Set identity to print, default is 'unbound'. | |
| void | log_set_time (uint32_t *t) |
| Set the time value to print in log entries. | |
| void | log_set_time_asc (int use_asc) |
| Set if the time value is printed ascii or decimal in log entries. | |
| void | log_info (const char *format,...) ATTR_FORMAT(printf |
| Log informational message. | |
| void void | log_err (const char *format,...) ATTR_FORMAT(printf |
| Log error message. | |
| void void void | log_warn (const char *format,...) ATTR_FORMAT(printf |
| Log warning message. | |
| void void void void | log_hex (const char *msg, void *data, size_t length) |
| Log a hex-string to the log. | |
| void | log_buf (enum verbosity_value level, const char *msg, ldns_buffer *buf) |
| Easy alternative for log_hex, takes a ldns_buffer. | |
| void | fatal_exit (const char *format,...) ATTR_FORMAT(printf |
| Log fatal error message, and exit the current process. | |
| void void | log_vmsg (int pri, const char *type, const char *format, va_list args) |
| va_list argument version of log_info. | |
Variables | |
| enum verbosity_value | verbosity |
| The global verbosity setting. | |
This file contains logging functions.
| enum verbosity_value |
| void verbose | ( | enum verbosity_value | level, |
| const char * | format, | ||
| ... | |||
| ) |
log a verbose message, pass the level for this message.
It has printf formatted arguments. No trailing newline is needed.
| level,: | verbosity level for this message, compared to global verbosity setting. |
| format,: | printf-style format string. Arguments follow. |
| void void log_init | ( | const char * | filename, |
| int | use_syslog, | ||
| const char * | chrootdir | ||
| ) |
call this to initialize logging services.
| filename,: | if NULL stderr is used. |
| use_syslog,: | set to true to ignore filename and use syslog(3). |
| chrootdir,: | to which directory we have been chrooted, if any. |
References ident, key_created, log_err(), logfile, logkey, VERB_QUERY, and verbose().
Referenced by context_finalize(), do_log_reopen(), main(), perform_setup(), run_daemon(), service_init(), service_start(), and ub_ctx_create().
| void log_file | ( | FILE * | f | ) |
Set logging to go to the specified file *.
This setting does not affect the use_syslog setting.
| f,: | to that file, or pass NULL to disable logging. |
References logfile.
Referenced by context_finalize(), and ub_ctx_debugout().
| void log_thread_set | ( | int * | num | ) |
Init a thread (will print this number for the thread log entries).
Must be called from the thread itself. If not called 0 is printed.
| num,: | number to print for this thread. Owned by caller, must continue to exist. |
References logkey.
Referenced by daemon_cleanup(), ext_thread(), libworker_dobg(), test_thr_main(), thread_start(), and win_do_cron().
| void log_ident_set | ( | const char * | id | ) |
Set identity to print, default is 'unbound'.
| id,: | string to print. Name of executable. |
References ident.
Referenced by main(), and ub_ctx_create().
| void log_set_time | ( | uint32_t * | t | ) |
Set the time value to print in log entries.
| t,: | the point is copied and used to find the time. if NULL, time(2) is used. |
References log_now.
Referenced by worker_delete(), and worker_init().
| void log_set_time_asc | ( | int | use_asc | ) |
Set if the time value is printed ascii or decimal in log entries.
| use_asc,: | if true, ascii is printed, otherwise decimal. If the conversion fails or you have no time functions, decimal is printed. |
References log_time_asc.
Referenced by config_apply().
| void log_info | ( | const char * | format, |
| ... | |||
| ) |
Log informational message.
Pass printf formatted arguments. No trailing newline is needed.
| format,: | printf-style format string. Arguments follow. |
| void void log_err | ( | const char * | format, |
| ... | |||
| ) |
Log error message.
Pass printf formatted arguments. No trailing newline is needed.
| format,: | printf-style format string. Arguments follow. |
| void void void log_warn | ( | const char * | format, |
| ... | |||
| ) |
Log warning message.
Pass printf formatted arguments. No trailing newline is needed.
| format,: | printf-style format string. Arguments follow. |
| void void void void log_hex | ( | const char * | msg, |
| void * | data, | ||
| size_t | length | ||
| ) |
Log a hex-string to the log.
Can be any length. performs mallocs to do so, slow. But debug useful.
| msg,: | string desc to accompany the hexdump. |
| data,: | data to dump in hex format. |
| length,: | length of data. |
References log_hex_f(), and verbosity.
Referenced by test_buffers().
| void log_buf | ( | enum verbosity_value | level, |
| const char * | msg, | ||
| ldns_buffer * | buf | ||
| ) |
Easy alternative for log_hex, takes a ldns_buffer.
| level,: | verbosity level for this message, compared to global verbosity setting. |
| msg,: | string desc to print |
| buf,: | the buffer. |
References log_hex_f(), and verbosity.
Referenced by outnet_udp_cb(), recv_one(), serviced_callbacks(), test_buffers(), and worker_handle_request().
| void fatal_exit | ( | const char * | format, |
| ... | |||
| ) |
Log fatal error message, and exit the current process.
Pass printf formatted arguments. No trailing newline is needed.
| format,: | printf-style format string. Arguments follow. |
| void void log_vmsg | ( | int | pri, |
| const char * | type, | ||
| const char * | format, | ||
| va_list | args | ||
| ) |
va_list argument version of log_info.
| pri,: | priority type, for example 5 (INFO). |
| type,: | string to designate type of message (info, error). |
| format,: | the printf style format to print. no newline. |
| args,: | arguments for format string. |
References ident, log_now, log_time_asc, logfile, logkey, MSG_GENERIC_ERR, MSG_GENERIC_INFO, MSG_GENERIC_SUCCESS, MSG_GENERIC_WARN, and SERVICE_NAME.
Referenced by fatal_exit(), log_err(), log_info(), log_warn(), and verbose().
1.7.6.1