aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2016-02-04 17:03:04 +0100
committerKim Alvefur <zash@zash.se>2016-02-04 17:03:04 +0100
commit2078539767e2795060200786a12dbd63f7239eaf (patch)
tree78cf28a74a32393a0e6809c0589f92d1ee17e8ae
parent40ce08301d6df9fd9662941fa455934bfc90f4ae (diff)
downloadprosody-2078539767e2795060200786a12dbd63f7239eaf.tar.gz
prosody-2078539767e2795060200786a12dbd63f7239eaf.zip
loggingmanager: Write out color code, log level and reset code in one call
-rw-r--r--core/loggingmanager.lua6
1 files changed, 2 insertions, 4 deletions
diff --git a/core/loggingmanager.lua b/core/loggingmanager.lua
index 8b68c26f..7d972bab 100644
--- a/core/loggingmanager.lua
+++ b/core/loggingmanager.lua
@@ -13,7 +13,7 @@ local setmetatable, rawset, pairs, ipairs, type =
local io_open, io_write = io.open, io.write;
local math_max, rep = math.max, string.rep;
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
if os.getenv("__FLUSH_LOG") then
@@ -235,9 +235,7 @@ do
io_write(os_date(timestamps), " ");
end
io_write(name, rep(" ", sourcewidth-namelen));
- setstyle(logstyles[level]);
- io_write(level);
- setstyle();
+ io_write(getstring(logstyles[level], level));
if ... then
io_write("\t", format(message, ...), "\n");
else