Comparison

core/loggingmanager.lua @ 2139:625b2d3e8900

loggingmanager: Explicitly flush log messages if the __FLUSH_LOG environment variable is defined (workaround for MSVCRT buffering piped output).
author Waqas Hussain <waqas20@gmail.com>
date Sun, 22 Nov 2009 21:33:41 +0500
parent 1892:adc0c80413ee
child 2586:26ead5e16cd3
child 2922:0ea2ed371fb2
comparison
equal deleted inserted replaced
2090:7810648ea26d 2139:625b2d3e8900
14 tostring, setmetatable, rawset, pairs, ipairs, type; 14 tostring, setmetatable, rawset, pairs, ipairs, type;
15 local io_open, io_write = io.open, io.write; 15 local io_open, io_write = io.open, io.write;
16 local math_max, rep = math.max, string.rep; 16 local math_max, rep = math.max, string.rep;
17 local os_date, os_getenv = os.date, os.getenv; 17 local os_date, os_getenv = os.date, os.getenv;
18 local getstyle, getstring = require "util.termcolours".getstyle, require "util.termcolours".getstring; 18 local getstyle, getstring = require "util.termcolours".getstyle, require "util.termcolours".getstring;
19
20 if os.getenv("__FLUSH_LOG") then
21 local io_flush = io.flush;
22 local _io_write = io_write;
23 io_write = function(...) _io_write(...); io_flush(); end
24 end
19 25
20 local config = require "core.configmanager"; 26 local config = require "core.configmanager";
21 local eventmanager = require "core.eventmanager"; 27 local eventmanager = require "core.eventmanager";
22 local logger = require "util.logger"; 28 local logger = require "util.logger";
23 local debug_mode = config.get("*", "core", "debug"); 29 local debug_mode = config.get("*", "core", "debug");