From: Vladimír Čunát Date: Thu, 29 Jul 2021 10:55:42 +0000 (+0200) Subject: lua logging: expand the printf in lua already X-Git-Tag: v5.4.0~2^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9a79c6f755ed74317f1b00ca18a97d9166c26c51;p=thirdparty%2Fknot-resolver.git lua logging: expand the printf in lua already - we've been using lua's formatting so far, so avoid changing that - some lua values would be harder to format with the C style --- diff --git a/daemon/lua/sandbox.lua.in b/daemon/lua/sandbox.lua.in index 432099c12..4a513b258 100644 --- a/daemon/lua/sandbox.lua.in +++ b/daemon/lua/sandbox.lua.in @@ -32,15 +32,17 @@ local function curr_line() return debug.getinfo(4,'l').currentline end local function log_fmt(grp, level, fmt, ...) ffi.C.kr_log_fmt(grp, level, 'CODE_FILE='..curr_file(), 'CODE_LINE='..curr_line(), '', - '[%-6s] ' .. fmt .. '\n', ffi.C.kr_log_grp2name(grp), ...) + '[%-6s] %s\n', ffi.C.kr_log_grp2name(grp), string.format(fmt, ...)) end function log_req(req, qry_uid, indent, grp, fmt, ...) - ffi.C.kr_log_req1(req, qry_uid, indent, grp, ffi.C.kr_log_grp2name(grp), fmt, ...) + ffi.C.kr_log_req1(req, qry_uid, indent, grp, ffi.C.kr_log_grp2name(grp), + '%s\n', string.format(fmt, ...)) end function log_qry(qry, grp, fmt, ...) - ffi.C.kr_log_q1(qry, grp, ffi.C.kr_log_grp2name(grp), fmt, ...) + ffi.C.kr_log_q1(qry, grp, ffi.C.kr_log_grp2name(grp), + '%s\n', string.format(fmt, ...)) end function panic(fmt, ...)