Skip to content

Commit 15dbf75

Browse files
Oleg Chaplashkinylobankov
authored andcommitted
Improve luatest.log function if a nil value is passed
Use `select()` to avoid `bad argument to '?' (no value)` error in following example: luatest.log('%s and %s', cdata<void *>: NULL, nil) Closes #360
1 parent e3ea6fc commit 15dbf75

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
- Add logging to unified file (gh-324).
66
- Add memory leak detection during server process execution (gh-349).
7+
- Improve `luatest.log` function if a `nil` value is passed (gh-360).
78

89
## 1.0.1
910

luatest/log.lua

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ local function _log(level, msg, ...)
1111
if not utils.version_current_ge_than(2, 5, 1) then
1212
return
1313
end
14-
local args = {...}
15-
for k, v in pairs(args) do
16-
args[k] = pp.tostringlog(v)
14+
local args = {}
15+
for i = 1, select('#', ...) do
16+
local v = select(i, ...)
17+
table.insert(args, pp.tostringlog(v))
1718
end
1819
return tarantool_log[level](msg, unpack(args))
1920
end

0 commit comments

Comments
 (0)