mirror of
https://github.com/bjc/prosody.git
synced 2025-04-04 21:57:45 +03:00
loggingmanager: Write out color code, log level and reset code in one call
This commit is contained in:
parent
fc2a0d90fc
commit
fe4731209e
1 changed files with 2 additions and 4 deletions
|
@ -13,7 +13,7 @@ local setmetatable, rawset, pairs, ipairs, type =
|
||||||
local io_open, io_write = io.open, io.write;
|
local io_open, io_write = io.open, io.write;
|
||||||
local math_max, rep = math.max, string.rep;
|
local math_max, rep = math.max, string.rep;
|
||||||
local os_date = os.date;
|
local os_date = os.date;
|
||||||
local getstyle, setstyle = require "util.termcolours".getstyle, require "util.termcolours".setstyle;
|
local getstyle, getstring = require "util.termcolours".getstyle, require "util.termcolours".getstring;
|
||||||
|
|
||||||
-- COMPAT: This should no longer be needed since the addition of setvbuf calls
|
-- COMPAT: This should no longer be needed since the addition of setvbuf calls
|
||||||
if os.getenv("__FLUSH_LOG") then
|
if os.getenv("__FLUSH_LOG") then
|
||||||
|
@ -235,9 +235,7 @@ do
|
||||||
io_write(os_date(timestamps), " ");
|
io_write(os_date(timestamps), " ");
|
||||||
end
|
end
|
||||||
io_write(name, rep(" ", sourcewidth-namelen));
|
io_write(name, rep(" ", sourcewidth-namelen));
|
||||||
setstyle(logstyles[level]);
|
io_write(getstring(logstyles[level], level));
|
||||||
io_write(level);
|
|
||||||
setstyle();
|
|
||||||
if ... then
|
if ... then
|
||||||
io_write("\t", format(message, ...), "\n");
|
io_write("\t", format(message, ...), "\n");
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue