Software / code / prosody
Comparison
util/logger.lua @ 147:ccebb2720741 s2s
working incoming s2s \o/
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Fri, 24 Oct 2008 06:13:38 +0100 |
| parent | 53:14ea0fe6ca86 |
| child | 259:1485d272400d |
comparison
equal
deleted
inserted
replaced
| 146:3826ca244eb6 | 147:ccebb2720741 |
|---|---|
| 4 local debug = debug; | 4 local debug = debug; |
| 5 local tostring = tostring; | 5 local tostring = tostring; |
| 6 module "logger" | 6 module "logger" |
| 7 | 7 |
| 8 function init(name) | 8 function init(name) |
| 9 name = nil; -- While this line is not commented, will automatically fill in file/line number info | 9 --name = nil; -- While this line is not commented, will automatically fill in file/line number info |
| 10 return function (level, message, ...) | 10 return function (level, message, ...) |
| 11 if not name then | 11 if not name then |
| 12 local inf = debug.getinfo(3, 'Snl'); | 12 local inf = debug.getinfo(3, 'Snl'); |
| 13 level = level .. ","..tostring(inf.short_src):match("[^/]*$")..":"..inf.currentline; | 13 level = level .. ","..tostring(inf.short_src):match("[^/]*$")..":"..inf.currentline; |
| 14 end | 14 end |