]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
knot-resolver: Use native logging functions
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 8 Jul 2026 16:24:44 +0000 (18:24 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 8 Jul 2026 16:24:44 +0000 (18:24 +0200)
The dummy functions were only to keep development quick when building
the proof-of-concept.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
config/knot-resolver/leases.lua

index e07885e60a1e3dd500f48491c09f9d180130f291..186dfe4d6fce59c86bbd91a44e3a2c6a4a52658d 100644 (file)
@@ -1,6 +1,10 @@
 -- Load modules
+local ffi = require("ffi")
 local sqlite3 = require("lsqlite3")
 
+-- Get access to the C interface
+local C = ffi.C
+
 local DB_PATH = "/var/lib/knot-resolver/leases.db"
 local TTL = 60
 
@@ -9,14 +13,6 @@ local db
 local sql_fwd
 local sql_rev
 
-local function log_error(s)
-       print(s)
-end
-
-local function log_debug(s)
-       print(s)
-end
-
 -- Initializes the module
 function M.init()
        -- Open the database
@@ -24,7 +20,7 @@ function M.init()
 
        -- Fail if we cannot open the database
        if not db then
-               log_error("leases: Failed to open " .. DB_PATH)
+               log_error(C.LOG_GRP_RESOLVER, "leases: Failed to open " .. DB_PATH)
                return -1
        end
 
@@ -129,7 +125,7 @@ function M.answer()
 
                -- Log action
                log_debug(
-                       string.format("Called for %s (%d)", qname, qtype)
+                       C.LOG_GRP_RESOLVER, string.format("Called for %s (%d)", qname, qtype)
                )
 
                local answer = {}