diff options
author | Kim Alvefur <zash@zash.se> | 2019-07-30 02:14:50 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2019-07-30 02:14:50 +0200 |
commit | 7bce7c9fbe91d12069da3821f732114eabeb1814 (patch) | |
tree | 314a49f63f508df6a9245609a935f9a8625b7dd1 | |
parent | cc653ef0d999ba46ad59cdd80be633a9f0d15557 (diff) | |
download | prosody-7bce7c9fbe91d12069da3821f732114eabeb1814.tar.gz prosody-7bce7c9fbe91d12069da3821f732114eabeb1814.zip |
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.
-rw-r--r-- | core/s2smanager.lua | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/core/s2smanager.lua b/core/s2smanager.lua index 48bf0544..ccdf4932 100644 --- a/core/s2smanager.lua +++ b/core/s2smanager.lua @@ -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 @@ end 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; |