aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2016-02-04 17:57:12 +0100
committerKim Alvefur <zash@zash.se>2016-02-04 17:57:12 +0100
commit883547a4db409190f32d2a1c3b843a0b4d0bbb96 (patch)
treea7d1ebfee348672596fcc5352c242d32a7cd9546 /core
parentc9f2829f6e58e2fbc06ad23c69cb51ac25aa7e80 (diff)
downloadprosody-883547a4db409190f32d2a1c3b843a0b4d0bbb96.tar.gz
prosody-883547a4db409190f32d2a1c3b843a0b4d0bbb96.zip
loggingmanager: Write out timestamps in same write() call as everything else
Diffstat (limited to 'core')
-rw-r--r--core/loggingmanager.lua11
1 files changed, 5 insertions, 6 deletions
diff --git a/core/loggingmanager.lua b/core/loggingmanager.lua
index b47c2ea5..00398229 100644
--- a/core/loggingmanager.lua
+++ b/core/loggingmanager.lua
@@ -35,7 +35,7 @@ local _ENV = nil;
-- The log config used if none specified in the config file (see reload_logging for initialization)
local default_logging;
local default_file_logging;
-local default_timestamp = "%b %d %H:%M:%S";
+local default_timestamp = "%b %d %H:%M:%S ";
-- The actual config loggingmanager is using
local logging_config;
@@ -187,6 +187,8 @@ local function log_to_file(sink_config, logfile)
if timestamps == true then
timestamps = default_timestamp; -- Default format
+ elseif timestamps then
+ timestamps = timestamps .. " ";
end
if sink_config.buffer_mode ~= false then
@@ -197,9 +199,6 @@ local function log_to_file(sink_config, logfile)
local sourcewidth = sink_config.source_width;
return function (name, level, message, ...)
- if timestamps then
- write(logfile, os_date(timestamps), " ");
- end
if sourcewidth then
sourcewidth = math_max(#name+2, sourcewidth);
name = name .. rep(" ", sourcewidth-#name);
@@ -207,9 +206,9 @@ local function log_to_file(sink_config, logfile)
name = name .. "\t";
end
if ... then
- write(logfile, name, level, "\t", format(message, ...), "\n");
+ write(logfile, timestamps and os_date(timestamps) or "", name, level, "\t", format(message, ...), "\n");
else
- write(logfile, name, level, "\t", message, "\n");
+ write(logfile, timestamps and os_date(timestamps) or "", name, level, "\t", message, "\n");
end
end
end