aboutsummaryrefslogtreecommitdiffstats
path: root/core/loggingmanager.lua
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2017-09-10 13:05:45 -0400
committerWaqas Hussain <waqas20@gmail.com>2017-09-10 13:05:45 -0400
commit79acb207db938b5f8c6384fa36a0d2467f763b9a (patch)
treee88b65d8d20941d8135c35f87a04a82ca644d1d6 /core/loggingmanager.lua
parent7e94950115a5c22748cf5a6c358a41ef74ce00fe (diff)
downloadprosody-79acb207db938b5f8c6384fa36a0d2467f763b9a.tar.gz
prosody-79acb207db938b5f8c6384fa36a0d2467f763b9a.zip
loggingmanager, mod_posix: Replace the old inconsistent log formatting with the new util.format
Diffstat (limited to 'core/loggingmanager.lua')
-rw-r--r--core/loggingmanager.lua13
1 files changed, 2 insertions, 11 deletions
diff --git a/core/loggingmanager.lua b/core/loggingmanager.lua
index 14305588..1b888a7e 100644
--- a/core/loggingmanager.lua
+++ b/core/loggingmanager.lua
@@ -7,7 +7,7 @@
--
-- luacheck: globals log prosody.log
-local format = string.format;
+local format = require "util.format";
local setmetatable, rawset, pairs, ipairs, type =
setmetatable, rawset, pairs, ipairs, type;
local stdout = io.stdout;
@@ -195,22 +195,13 @@ local function log_to_file(sink_config, logfile)
local sourcewidth = sink_config.source_width;
return function (name, level, message, ...)
- local n = select('#', ...);
- if n ~= 0 then
- local arg = { ... };
- for i = 1, n do
- arg[i] = tostring(arg[i]);
- end
- message = format(message, unpack(arg, 1, n));
- end
-
if sourcewidth then
sourcewidth = math_max(#name+2, sourcewidth);
name = name .. rep(" ", sourcewidth-#name);
else
name = name .. "\t";
end
- write(logfile, timestamps and os_date(timestamps) or "", name, level, "\t", message, "\n");
+ write(logfile, timestamps and os_date(timestamps) or "", name, level, "\t", format(message, ...), "\n");
end
end
log_sink_types.file = log_to_file;