Software /
code /
prosody
Diff
core/s2smanager.lua @ 10103:18cab054364a
core.s2smanager: Rewrite log line to use formatting instead of concatenation
Makes it more in line with logging elsewhere. Potentially avoids or at
least delays creation of new string.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 30 Jul 2019 02:14:50 +0200 |
parent | 10102:77a21eef243b |
child | 10243:b36765ab0ae3 |
line wrap: on
line diff
--- a/core/s2smanager.lua Mon Jul 29 23:15:30 2019 +0200 +++ b/core/s2smanager.lua Tue Jul 30 02:14:50 2019 +0200 @@ -9,8 +9,7 @@ local hosts = prosody.hosts; -local tostring, pairs, setmetatable - = tostring, pairs, setmetatable; +local pairs, setmetatable = pairs, setmetatable; local logger_init = require "util.logger".init; local sessionlib = require "util.session"; @@ -84,9 +83,8 @@ local function destroy_session(session, reason) if session.destroyed then return; end - (session.log or log)("debug", "Destroying "..tostring(session.direction) - .." session "..tostring(session.from_host).."->"..tostring(session.to_host) - ..(reason and (": "..reason) or "")); + local log = session.log or log; + log("debug", "Destroying %s session %s->%s%s%s", session.direction, session.from_host, session.to_host, reason and ": " or "", reason or ""); if session.direction == "outgoing" then hosts[session.from_host].s2sout[session.to_host] = nil;