IMPORTANT: due to a drive failure, as of 13-Mar-2021, the Mercurial repository had to be re-mirrored, which changed every commit SHA. The old SHAs and trees are backed up in the vault branches. Please migrate to the new branches as soon as you can.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
prosody/util/logger.lua

23 lines
562 B

local format = string.format;
local print = print;
local debug = debug;
local tostring = tostring;
module "logger"
function init(name)
name = nil; -- While this line is not commented, will automatically fill in file/line number info
return function (level, message, ...)
if not name then
local inf = debug.getinfo(3, 'Snl');
level = level .. ","..tostring(inf.short_src):match("[^/]*$")..":"..inf.currentline;
end
if ... then
print(level, format(message, ...));
else
print(level, message);
end
end
end
return _M;