Logging API¶
Group names
- LOG_GRP_SYSTEM_TAG¶
system
: catch-all log for generic messages
- LOG_GRP_CACHE_TAG¶
cache
: operations related to cache
- LOG_GRP_IO_TAG¶
io
: input/output operations
- LOG_GRP_NETWORK_TAG¶
net
: network configuration and operation
- LOG_GRP_TA_TAG¶
ta
: basic log for trust anchors (TA)
- LOG_GRP_TASENTINEL_TAG¶
tasent
: TA sentinel
- LOG_GRP_TASIGNALING_TAG¶
tasign
: TA signal query
- LOG_GRP_TAUPDATE_TAG¶
taupd
: TA update
- LOG_GRP_TLS_TAG¶
tls
: TLS encryption layer
- LOG_GRP_GNUTLS_TAG¶
gnutls
: low-level logs from GnuTLS
- LOG_GRP_TLSCLIENT_TAG¶
tls_cl
: TLS client messages (used for TLS forwarding)
- LOG_GRP_XDP_TAG¶
xdp
: operations related to XDP
- LOG_GRP_DOH_TAG¶
doh
: DNS-over-HTTPS logger (doh2 implementation)
- LOG_GRP_DNSSEC_TAG¶
dnssec
: operations related to DNSSEC
- LOG_GRP_HINT_TAG¶
hint
: operations related to static hints
- LOG_GRP_PLAN_TAG¶
plan
: operations related to resolution plan
- LOG_GRP_ITERATOR_TAG¶
iterat
: operations related to iterate layer
- LOG_GRP_VALIDATOR_TAG¶
valdtr
: operations related to validate layer
- LOG_GRP_RESOLVER_TAG¶
resolv
: operations related to resolving
- LOG_GRP_SELECTION_TAG¶
select
: operations related to server selection
- LOG_GRP_ZCUT_TAG¶
zonecut
: operations related to zone cut
- LOG_GRP_COOKIES_TAG¶
cookie
: operations related to cookies
- LOG_GRP_STATISTICS_TAG¶
statis
: operations related to statistics
- LOG_GRP_REBIND_TAG¶
rebind
: operations related to rebinding
- LOG_GRP_WORKER_TAG¶
worker
: operations related to worker layer
- LOG_GRP_POLICY_TAG¶
policy
: operations related to policy
- LOG_GRP_DAF_TAG¶
daf
: operations related to DAF module
- LOG_GRP_DETECTTIMEJUMP_TAG¶
timejm
: operations related to time jump
- LOG_GRP_DETECTTIMESKEW_TAG¶
timesk
: operations related to time skew
- LOG_GRP_GRAPHITE_TAG¶
graphi
: operations related to graphite
- LOG_GRP_PREFILL_TAG¶
prefil
: operations related to prefill
- LOG_GRP_PRIMING_TAG¶
primin
: operations related to priming
- LOG_GRP_SRVSTALE_TAG¶
srvstl
: operations related to serve stale
- LOG_GRP_WATCHDOG_TAG¶
wtchdg
: operations related to watchdog
- LOG_GRP_NSID_TAG¶
nsid
: operations related to NSID
- LOG_GRP_DNSTAP_TAG¶
dnstap
: operations related to dnstap
- LOG_GRP_TESTS_TAG¶
tests
: operations related to tests
- LOG_GRP_DOTAUTH_TAG¶
dotaut
: DNS-over-TLS against authoritative servers
- LOG_GRP_HTTP_TAG¶
http
: http module, its web interface and legacy DNS-over-HTTPS
- LOG_GRP_CONTROL_TAG¶
contrl
: TTY control sockets
- LOG_GRP_MODULE_TAG¶
module
: suitable for user-defined modules
- LOG_GRP_DEVEL_TAG¶
devel
: for development purposes
- LOG_GRP_RENUMBER_TAG¶
renum
: operation related to renumber
- LOG_GRP_EDE_TAG¶
exterr
: extended error module
- LOG_GRP_RULES_TAG¶
rules
: new policy rules (their processing)
- LOG_GRP_PROTOLAYER_TAG¶
prlayr
: protocol layer system (session2)
- LOG_GRP_REQDBG_TAG¶
reqdbg
: debug logs enabled by policy actions
Logging levels
We stick very close to POSIX syslog.h
- kr_log_debug(grp, fmt, ...)¶
Debugging message.
Can be very verbose. The level is most often used through VERBOSE_MSG.
- kr_log_info(grp, fmt, ...)¶
- kr_log_notice(grp, fmt, ...)¶
- LOG_DEFAULT_LEVEL¶
Levels less severe than
notice
are not logged by default.
- kr_log_warning(grp, fmt, ...)¶
- kr_log_error(grp, fmt, ...)¶
Significant error.
The process continues, except for configuration errors during startup.
- kr_log_crit(grp, fmt, ...)¶
Critical condition.
The process dies. Bad configuration should not cause this.
- kr_log_deprecate(grp, fmt, ...)¶
- kr_log(fmt, ...)¶
Logging function for user modules.
Uses group LOG_GRP_MODULE and
info
level.- Parameters:
fmt – Format string
Defines
- LOG_UNKNOWN_LEVEL¶
Negative error value.
- LOG_GNUTLS_LEVEL¶
GnuTLS level is 5.
- KR_LOG_LEVEL_IS(exp)¶
- kr_log_req(req, qry_uid, indent, grp, fmt, ...)¶
Log a debug-level message from a kr_request.
Typically we call kr_log_q() instead.
- Parameters:
qry_uid – query ID to append to request ID, 0 means “no query”
indent – level of indentation between [group ][req.qry] and message
grp – GROUP_NAME (without the LOG_GRP_ prefix)
fmt – printf-like format string
- kr_log_q(qry, grp, fmt, ...)¶
Log a debug-level message from a kr_query.
- Parameters:
qry – current query
grp – GROUP_NAME (without the LOG_GRP_ prefix)
fmt – printf-like format string
- kr_log_is_debug(grp, req)¶
Return whether a particular log group in a request is in debug/verbose mode.
Typically you use this as condition to compute some data to be logged, in case that’s considered too expensive to do unless it really gets logged.
The request can be NULL, and there’s a _qry() shorthand to specify query instead.
- kr_log_is_debug_qry(grp, qry)¶
- KR_LOG_SJM_STR(x)¶
- SD_JOURNAL_METADATA¶
Typedefs
- typedef int kr_log_level_t¶
Enums
- enum kr_log_target_t¶
Values:
- enumerator LOG_TARGET_SYSLOG¶
- enumerator LOG_TARGET_STDERR¶
- enumerator LOG_TARGET_STDOUT¶
- enumerator LOG_TARGET_DEFAULT¶
- enumerator LOG_TARGET_SYSLOG¶
- enum kr_log_group¶
Values:
- enumerator LOG_GRP_UNKNOWN¶
- enumerator LOG_GRP_SYSTEM¶
- enumerator LOG_GRP_CACHE¶
- enumerator LOG_GRP_IO¶
- enumerator LOG_GRP_NETWORK¶
- enumerator LOG_GRP_TA¶
- enumerator LOG_GRP_TLS¶
- enumerator LOG_GRP_GNUTLS¶
- enumerator LOG_GRP_TLSCLIENT¶
- enumerator LOG_GRP_XDP¶
- enumerator LOG_GRP_DOH¶
- enumerator LOG_GRP_DNSSEC¶
- enumerator LOG_GRP_HINT¶
- enumerator LOG_GRP_PLAN¶
- enumerator LOG_GRP_ITERATOR¶
- enumerator LOG_GRP_VALIDATOR¶
- enumerator LOG_GRP_RESOLVER¶
- enumerator LOG_GRP_SELECTION¶
- enumerator LOG_GRP_ZCUT¶
- enumerator LOG_GRP_COOKIES¶
- enumerator LOG_GRP_STATISTICS¶
- enumerator LOG_GRP_REBIND¶
- enumerator LOG_GRP_WORKER¶
- enumerator LOG_GRP_POLICY¶
- enumerator LOG_GRP_TASENTINEL¶
- enumerator LOG_GRP_TASIGNALING¶
- enumerator LOG_GRP_TAUPDATE¶
- enumerator LOG_GRP_DAF¶
- enumerator LOG_GRP_DETECTTIMEJUMP¶
- enumerator LOG_GRP_DETECTTIMESKEW¶
- enumerator LOG_GRP_GRAPHITE¶
- enumerator LOG_GRP_PREFILL¶
- enumerator LOG_GRP_PRIMING¶
- enumerator LOG_GRP_SRVSTALE¶
- enumerator LOG_GRP_WATCHDOG¶
- enumerator LOG_GRP_NSID¶
- enumerator LOG_GRP_DNSTAP¶
- enumerator LOG_GRP_TESTS¶
- enumerator LOG_GRP_DOTAUTH¶
- enumerator LOG_GRP_HTTP¶
- enumerator LOG_GRP_CONTROL¶
- enumerator LOG_GRP_MODULE¶
- enumerator LOG_GRP_DEVEL¶
- enumerator LOG_GRP_RENUMBER¶
- enumerator LOG_GRP_EDE¶
- enumerator LOG_GRP_RULES¶
- enumerator LOG_GRP_PROTOLAYER¶
- enumerator LOG_GRP_REQDBG¶
- enumerator LOG_GRP_UNKNOWN¶
Functions
- void kr_log_target_set(kr_log_target_t target)¶
Set the current logging target.
- bool kr_log_group_is_set(enum kr_log_group group)¶
- void kr_log_group_add(enum kr_log_group group)¶
- void kr_log_group_reset(void)¶
- const char *kr_log_grp2name(enum kr_log_group group)¶
- enum kr_log_group kr_log_name2grp(const char *name)¶
- void kr_log_level_set(kr_log_level_t level)¶
Set the current logging level.
- const char *kr_log_level2name(kr_log_level_t level)¶
- kr_log_level_t kr_log_name2level(const char *name)¶
Return negative on error.
- void kr_log_req1(const struct kr_request *const req, uint32_t qry_uid, const unsigned int indent, enum kr_log_group group, const char *tag, const char *fmt, ...)¶
- void kr_log_q1(const struct kr_query *qry, enum kr_log_group group, const char *tag, const char *fmt, ...)¶
- bool kr_log_is_debug_fun(enum kr_log_group group, const struct kr_request *req)¶
- void kr_log_fmt(enum kr_log_group group, kr_log_level_t level, const char *file, const char *line, const char *func, const char *fmt, ...)¶
Variables
- kr_log_target_t kr_log_target¶
Current logging target.
Read only, please.
- kr_log_level_t kr_log_level¶
Current logging level.
Read only, please.