Comparison

spec/util_async_spec.lua @ 8617:fafb4036771c

util.async: if debugging is enabled, use runner id in logs
author Matthew Wild <mwild1@gmail.com>
date Sat, 17 Mar 2018 17:29:13 +0000
parent 8616:a15c891c6232
child 8618:680b1caa2dea
comparison
equal deleted inserted replaced
8616:a15c891c6232 8617:fafb4036771c
11 local function new(func, name) 11 local function new(func, name)
12 local log = {}; 12 local log = {};
13 return async.runner(func, setmetatable({}, { 13 return async.runner(func, setmetatable({}, {
14 __index = function (_, event) 14 __index = function (_, event)
15 return function (runner, err) 15 return function (runner, err)
16 print(name, "event", event, err) 16 print(name or runner.id, "event", event, err)
17 print "--" 17 print "--"
18 table.insert(log, { event = event, err = err }); 18 table.insert(log, { event = event, err = err });
19 end; 19 end;
20 end; 20 end;
21 })), log; 21 })), log;