diff options
author | Matthew Wild <mwild1@gmail.com> | 2012-07-23 17:32:33 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2012-07-23 17:32:33 +0100 |
commit | e89b006f03f692a7e807c54757f0623302c40b85 (patch) | |
tree | 9c9c3219211b2f9e2eca26d188f9f44924922db7 /plugins | |
parent | badc4159d600642f97d064a7f74c2ff68dda8abf (diff) | |
download | prosody-e89b006f03f692a7e807c54757f0623302c40b85.tar.gz prosody-e89b006f03f692a7e807c54757f0623302c40b85.zip |
Hopefully inert commit to clean up logging across a number of modules, removing all cases of concatenation when building log messages
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/adhoc/adhoc.lib.lua | 4 | ||||
-rw-r--r-- | plugins/mod_admin_adhoc.lua | 11 | ||||
-rw-r--r-- | plugins/mod_component.lua | 2 | ||||
-rw-r--r-- | plugins/mod_dialback.lua | 3 | ||||
-rw-r--r-- | plugins/mod_posix.lua | 12 | ||||
-rw-r--r-- | plugins/mod_presence.lua | 6 | ||||
-rw-r--r-- | plugins/mod_s2s/mod_s2s.lua | 2 |
7 files changed, 19 insertions, 21 deletions
diff --git a/plugins/adhoc/adhoc.lib.lua b/plugins/adhoc/adhoc.lib.lua index f9510172..acdae6b9 100644 --- a/plugins/adhoc/adhoc.lib.lua +++ b/plugins/adhoc/adhoc.lib.lua @@ -65,8 +65,8 @@ function _M.handle_cmd(command, origin, stanza) if (action == "prev") or (action == "next") or (action == "complete") then actions:tag(action):up(); else - module:log("error", 'Command "'..command.name.. - '" at node "'..command.node..'" provided an invalid action "'..action..'"'); + module:log("error", "Command %q at node %q provided an invalid action %q", + command.name, command.node, action); end end cmdtag:add_child(actions); diff --git a/plugins/mod_admin_adhoc.lua b/plugins/mod_admin_adhoc.lua index ee89d84f..016eeb4a 100644 --- a/plugins/mod_admin_adhoc.lua +++ b/plugins/mod_admin_adhoc.lua @@ -63,15 +63,14 @@ function add_user_command_handler(self, data, state) return { status = "completed", error = { message = "Account already exists" } }; else if usermanager_create_user(username, fields.password, host) then - module:log("info", "Created new account " .. username.."@"..host); + module:log("info", "Created new account %s@%s", username, host); return { status = "completed", info = "Account successfully created" }; else return { status = "completed", error = { message = "Failed to write data to disk" } }; end end else - module:log("debug", (fields.accountjid or "<nil>") .. " " .. (fields.password or "<nil>") .. " " - .. (fields["password-verify"] or "<nil>")); + module:log("debug", "Invalid data, password mismatch or empty username while creating account for %s", fields.accountjid or "<nil>"); return { status = "completed", error = { message = "Invalid data.\nPassword mismatch, or empty username" } }; end else @@ -143,10 +142,10 @@ function delete_user_command_handler(self, data, state) for _, aJID in ipairs(fields.accountjids) do local username, host, resource = jid.split(aJID); if (host == data.to) and usermanager_user_exists(username, host) and disconnect_user(aJID) and usermanager_create_user(username, nil, host) then - module:log("debug", "User " .. aJID .. " has been deleted"); + module:log("debug", "User %s has been deleted", aJID); succeeded[#succeeded+1] = aJID; else - module:log("debug", "Tried to delete non-existant user "..aJID); + module:log("debug", "Tried to delete non-existant user %s", aJID); failed[#failed+1] = aJID; end end @@ -165,7 +164,7 @@ function disconnect_user(match_jid) local sessions = host.sessions[node] and host.sessions[node].sessions; for resource, session in pairs(sessions or {}) do if not givenResource or (resource == givenResource) then - module:log("debug", "Disconnecting "..node.."@"..hostname.."/"..resource); + module:log("debug", "Disconnecting %s@%s/%s", node, hostname, resource); session:close(); end end diff --git a/plugins/mod_component.lua b/plugins/mod_component.lua index 738124cc..4037ad28 100644 --- a/plugins/mod_component.lua +++ b/plugins/mod_component.lua @@ -124,7 +124,7 @@ local xmlns_xmpp_streams = "urn:ietf:params:xml:ns:xmpp-streams"; function stream_callbacks.error(session, error, data, data2) if session.destroyed then return; end - module:log("warn", "Error processing component stream: "..tostring(error)); + module:log("warn", "Error processing component stream: %s", tostring(error)); if error == "no-stream" then session:close("invalid-namespace"); elseif error == "parse-error" then diff --git a/plugins/mod_dialback.lua b/plugins/mod_dialback.lua index 67be15e3..73a799e9 100644 --- a/plugins/mod_dialback.lua +++ b/plugins/mod_dialback.lua @@ -102,7 +102,6 @@ module:hook("stanza/jabber:server:dialback:verify", function(event) if origin.type == "s2sout_unauthed" or origin.type == "s2sout" then local attr = stanza.attr; local dialback_verifying = dialback_requests[attr.from.."/"..(attr.id or "")]; - module:log("debug", tostring(dialback_verifying).." "..attr.from.." "..origin.to_host); if dialback_verifying and attr.from == origin.to_host then local valid; if attr.type == "valid" then @@ -110,7 +109,7 @@ module:hook("stanza/jabber:server:dialback:verify", function(event) valid = "valid"; else -- Warn the original connection that is was not verified successfully - log("warn", "authoritative server for "..(attr.from or "(unknown)").." denied the key"); + log("warn", "authoritative server for %s denied the key", attr.from or "(unknown)"); valid = "invalid"; end if not dialback_verifying.sends2s then diff --git a/plugins/mod_posix.lua b/plugins/mod_posix.lua index 1670ac95..db594ccc 100644 --- a/plugins/mod_posix.lua +++ b/plugins/mod_posix.lua @@ -34,19 +34,19 @@ module:hook("server-started", function () if gid then local success, msg = pposix.setgid(gid); if success then - module:log("debug", "Changed group to "..gid.." successfully."); + module:log("debug", "Changed group to %s successfully.", gid); else - module:log("error", "Failed to change group to "..gid..". Error: "..msg); - prosody.shutdown("Failed to change group to "..gid); + module:log("error", "Failed to change group to %s. Error: %s", gid, msg); + prosody.shutdown("Failed to change group to %s", gid); end end if uid then local success, msg = pposix.setuid(uid); if success then - module:log("debug", "Changed user to "..uid.." successfully."); + module:log("debug", "Changed user to %s successfully.", uid); else - module:log("error", "Failed to change user to "..uid..". Error: "..msg); - prosody.shutdown("Failed to change user to "..uid); + module:log("error", "Failed to change user to %s. Error: %s", uid, msg); + prosody.shutdown("Failed to change user to %s", uid); end end end); diff --git a/plugins/mod_presence.lua b/plugins/mod_presence.lua index 09a6f9f2..3cac0973 100644 --- a/plugins/mod_presence.lua +++ b/plugins/mod_presence.lua @@ -160,7 +160,7 @@ function send_presence_of_available_resources(user, host, jid, recipient_session end end end - log("debug", "broadcasted presence of "..count.." resources from "..user.."@"..host.." to "..jid); + log("debug", "broadcasted presence of %d resources from %s@%s to %s", count, user, host, jid); return count; end @@ -169,7 +169,7 @@ function handle_outbound_presence_subscriptions_and_probes(origin, stanza, from_ if to_bare == from_bare then return; end -- No self contacts local st_from, st_to = stanza.attr.from, stanza.attr.to; stanza.attr.from, stanza.attr.to = from_bare, to_bare; - log("debug", "outbound presence "..stanza.attr.type.." from "..from_bare.." for "..to_bare); + log("debug", "outbound presence %s from %s for %s", stanza.attr.type, from_bare, to_bare); if stanza.attr.type == "probe" then stanza.attr.from, stanza.attr.to = st_from, st_to; return; @@ -214,7 +214,7 @@ function handle_inbound_presence_subscriptions_and_probes(origin, stanza, from_b local node, host = jid_split(to_bare); local st_from, st_to = stanza.attr.from, stanza.attr.to; stanza.attr.from, stanza.attr.to = from_bare, to_bare; - log("debug", "inbound presence "..stanza.attr.type.." from "..from_bare.." for "..to_bare); + log("debug", "inbound presence %s from %s for %s", stanza.attr.type, from_bare, to_bare); if stanza.attr.type == "probe" then local result, err = rostermanager.is_contact_subscribed(node, host, from_bare); diff --git a/plugins/mod_s2s/mod_s2s.lua b/plugins/mod_s2s/mod_s2s.lua index 16a8b461..314be3f0 100644 --- a/plugins/mod_s2s/mod_s2s.lua +++ b/plugins/mod_s2s/mod_s2s.lua @@ -99,7 +99,7 @@ function route_to_existing_session(event) log("error", "We are going to send from %s instead of %s", tostring(host.from_host), tostring(from_host)); end if host.sends2s(stanza) then - host.log("debug", "stanza sent over "..host.type); + host.log("debug", "stanza sent over %s", host.type); return true; end end |