]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
etc/config: Remove log functions
authorLukáš Ježek <lukas.jezek@nic.cz>
Wed, 21 Jul 2021 10:50:04 +0000 (12:50 +0200)
committerTomas Krizek <tomas.krizek@nic.cz>
Thu, 29 Jul 2021 09:42:34 +0000 (11:42 +0200)
etc/config/config.docker
etc/config/config.isp

index f036fd55fe13e8c626a7f809c841093a431086a4..4805ae32bacdf7df8c5e3ae2c5289fe428f5ed37 100644 (file)
@@ -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)
index 3dc3e7f0e1ced82ec1cd90e91aff89dcf3e47cce..d4e2f9af98ad0710ffbca9401db70cfd8d3ef643 100644 (file)
@@ -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