Changeset

7133:ac142f5209d9

loggingmanager: Write out color code, log level and reset code in one call
author Kim Alvefur <zash@zash.se>
date Thu, 04 Feb 2016 17:03:04 +0100
parents 7132:3868d231c2c5
children 7134:b7b6b1d01224
files core/loggingmanager.lua
diffstat 1 files changed, 2 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/core/loggingmanager.lua	Thu Feb 04 16:56:05 2016 +0100
+++ b/core/loggingmanager.lua	Thu Feb 04 17:03:04 2016 +0100
@@ -13,7 +13,7 @@
 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 @@
 				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