X-Git-Url: https://git.enpas.org/?a=blobdiff_plain;f=core%2Floggingmanager.lua;h=4154e1a7b3131656091ae2e6376c553fde185a4b;hb=23c6f9b64369d6ac527c8e03bea3ad81d31fbe80;hp=1d2f8d7df9ccf6f5edb5d34d8caec097143eded5;hpb=82aa9c749335a601ec308148ce95e3c680ad7705;p=prosody.git diff --git a/core/loggingmanager.lua b/core/loggingmanager.lua index 1d2f8d7d..4154e1a7 100644 --- a/core/loggingmanager.lua +++ b/core/loggingmanager.lua @@ -17,6 +17,12 @@ 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; +if os.getenv("__FLUSH_LOG") then + local io_flush = io.flush; + local _io_write = io_write; + io_write = function(...) _io_write(...); io_flush(); end +end + local config = require "core.configmanager"; local eventmanager = require "core.eventmanager"; local logger = require "util.logger"; @@ -187,6 +193,7 @@ do return function (name, level, message, ...) sourcewidth = math_max(#name+2, sourcewidth); local namelen = #name; + if timestamps then io_write(os_date(timestamps), " "); end @@ -222,7 +229,7 @@ function log_sink_types.file(config) local timestamps = config.timestamps; - if timestamps == true then + if timestamps == nil or timestamps == true then timestamps = default_timestamp; -- Default format end