2 local format = string.format;
5 local tostring = tostring;
7 local getstyle, getstring = require "util.termcolours".getstyle, require "util.termcolours".getstring;
8 local do_pretty_printing = not os.getenv("WINDIR");
14 --TODO: This should be done in config, but we don't have proper config yet
15 if do_pretty_printing then
16 logstyles["info"] = getstyle("bold");
17 logstyles["warn"] = getstyle("bold", "yellow");
18 logstyles["error"] = getstyle("bold", "red");
22 --name = nil; -- While this line is not commented, will automatically fill in file/line number info
23 return function (level, message, ...)
25 local inf = debug.getinfo(3, 'Snl');
26 level = level .. ","..tostring(inf.short_src):match("[^/]*$")..":"..inf.currentline;
29 print(name, getstring(logstyles[level], level), format(message, ...));
31 print(name, getstring(logstyles[level], level), message);