4 -- Written by Timm S. Mueller <tmueller at neoscientists.org>
5 -- See copyright notice in COPYRIGHT
8 local getinfo = require "debug".getinfo
9 local date = require "os".date
10 local stderr = require "io".stderr
11 local tostring = tostring
16 module "tek.lib.debug"
18 level = 10 -- global default
20 function print(lvl, msg, ...)
21 if level and lvl >= level then
22 local t = getinfo(3, "lS")
24 for i, v in ipairs { ... } do
25 arg[i] = type(v) == "table" and tostring(v) or v
27 stderr:write(("(%02d %s:%d) %s\n"):format(lvl,
28 t.short_src, t.currentline, msg:format(unpack(arg))))
32 function debug(msg, ...)
36 function trace(msg, ...)
40 function info(msg, ...)
44 function warn(msg, ...)
48 function error(msg, ...)
52 function fail(msg, ...)