Skip to content
Snippets Groups Projects
Verified Commit 79df6987 authored by Lukas Jezek's avatar Lukas Jezek Committed by Tomas Krizek
Browse files

etc/config: Remove log functions

parent 40c6e136
Branches
Tags
1 merge request!1181Fine grained logging
......@@ -6,6 +6,8 @@ print('Knot Resolver ' .. package_version())
-- Smaller cache size
cache.size = 10 * MB
local ffi = require('ffi')
function interactive_mode()
-- Listen on all interfaces (localhost would not work in Docker)
net.listen('0.0.0.0', 53, { kind = 'dns' })
......@@ -62,7 +64,7 @@ function debug_mode(qname, qtype)
-- ultra verbose log
verbose(true)
policy.add(policy.all(policy.DEBUG_ALWAYS))
log('INFO: starting DNS query for %s %s', qname, kres.tostring.type[qtype])
log_debug(ffi.C.LOG_GRP_RESOLVER, 'starting DNS query for %s %s', qname, kres.tostring.type[qtype])
local starttime = cqueues.monotime()
resolve({
name = qname,
......@@ -74,7 +76,7 @@ function debug_mode(qname, qtype)
event.after(1, -- milisecond
function()
local endtime = cqueues.monotime()
log('\nrequest finished in %f ms', (endtime - starttime) * 1000)
log_debug(ffi.C.LOG_GRP_RESOLVER, '\nrequest finished in %f ms', (endtime - starttime) * 1000)
os.exit()
end)
end
......@@ -87,7 +89,7 @@ local qtype = os.getenv('QTYPE')
if qname and qtype then
qtypenum = kres.type[qtype]
if not qtypenum then
log('ERROR: unsupported query type "%s", use TYPE12345 notation', qtype)
log_error(ffi.C.LOG_GRP_RESOLVER, 'ERROR: unsupported query type "%s", use TYPE12345 notation', qtype)
os.exit()
end
debug_mode(qname, qtypenum)
......
......@@ -20,9 +20,11 @@ modules = {
'stats'
}
local ffi = require('ffi')
-- log statistics every second
local stat_id = event.recurrent(1 * second, function(evid)
log(table_print(stats.list()))
log_info(ffi.C.LOG_GRP_STATISTICS, table_print(stats.list()))
end)
-- stop printing statistics after first minute
......@@ -42,7 +44,7 @@ function speed_monitor()
local slow_increment = now['answer.slow'] - previous['answer.slow']
-- if percentage of slow answers is bigger than 5%, print warning
if slow_increment / total_increment > 0.05 then
log('WARNING! More than 5 %% of queries was slow!')
log_warn(ffi.C.LOG_GRP_STATISTICS, 'WARNING! More than 5 %% of queries was slow!')
end
previous = now
end
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment