aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2017-09-10 13:13:24 -0400
committerWaqas Hussain <waqas20@gmail.com>2017-09-10 13:13:24 -0400
commitf4aebb575ef73d5f9bce263af4146196c17cf66b (patch)
treecc156054619fb9b58c71786feb7cc597bec5045d /core
parent00cb31f022a3325e4e182b666f85a6b4e05b7a7e (diff)
downloadprosody-f4aebb575ef73d5f9bce263af4146196c17cf66b.tar.gz
prosody-f4aebb575ef73d5f9bce263af4146196c17cf66b.zip
loggingmanager: Slight cleanup and optimization of file sink
Diffstat (limited to 'core')
-rw-r--r--core/loggingmanager.lua13
1 files changed, 7 insertions, 6 deletions
diff --git a/core/loggingmanager.lua b/core/loggingmanager.lua
index 1b888a7e..2e9590fe 100644
--- a/core/loggingmanager.lua
+++ b/core/loggingmanager.lua
@@ -194,14 +194,15 @@ local function log_to_file(sink_config, logfile)
-- Column width for "source" (used by stdout and console)
local sourcewidth = sink_config.source_width;
- return function (name, level, message, ...)
- if sourcewidth then
+ if sourcewidth then
+ return function (name, level, message, ...)
sourcewidth = math_max(#name+2, sourcewidth);
- name = name .. rep(" ", sourcewidth-#name);
- else
- name = name .. "\t";
+ write(logfile, timestamps and os_date(timestamps) or "", name, rep(" ", sourcewidth-#name), level, "\t", format(message, ...), "\n");
+ end
+ else
+ return function (name, level, message, ...)
+ write(logfile, timestamps and os_date(timestamps) or "", name, "\t", level, "\t", format(message, ...), "\n");
end
- write(logfile, timestamps and os_date(timestamps) or "", name, level, "\t", format(message, ...), "\n");
end
end
log_sink_types.file = log_to_file;