# HG changeset patch # User Waqas Hussain # Date 1292360230 -18000 # Node ID e076e4bf70bf8238a258a9c1823836e6b06a9f8e # Parent 588c09d7903ca61b58647261741a6231bcbe9791 core.loggingmanager: Updated to use termcolours.getstyle instead of termcolours.getstring for console logging. diff -r 588c09d7903c -r e076e4bf70bf core/loggingmanager.lua --- a/core/loggingmanager.lua Wed Dec 15 01:55:13 2010 +0500 +++ b/core/loggingmanager.lua Wed Dec 15 01:57:10 2010 +0500 @@ -15,7 +15,7 @@ local io_open, io_write = io.open, io.write; local math_max, rep = math.max, string.rep; local os_date, os_getenv = os.date, os.getenv; -local getstyle, getstring = require "util.termcolours".getstyle, require "util.termcolours".getstring; +local getstyle, setstyle = require "util.termcolours".getstyle, require "util.termcolours".setstyle; if os.getenv("__FLUSH_LOG") then local io_flush = io.flush; @@ -217,7 +217,7 @@ end do - local do_pretty_printing = not os_getenv("WINDIR"); + local do_pretty_printing = true; local logstyles = {}; if do_pretty_printing then @@ -244,10 +244,14 @@ if timestamps then io_write(os_date(timestamps), " "); end + io_write(name, rep(" ", sourcewidth-namelen)); + setstyle(logstyles[level]); + io_write(level); + setstyle(); if ... then - io_write(name, rep(" ", sourcewidth-namelen), getstring(logstyles[level], level), "\t", format(message, ...), "\n"); + io_write("\t", format(message, ...), "\n"); else - io_write(name, rep(" ", sourcewidth-namelen), getstring(logstyles[level], level), "\t", message, "\n"); + io_write("\t", message, "\n"); end end end