From cf460a95bd509945b22adf2879d3858a99583047 Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Sat, 24 Aug 2019 22:15:18 -0700 Subject: [PATCH] Add some more logging in telex. --- mods/telex/init.lua | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/mods/telex/init.lua b/mods/telex/init.lua index 47fdca7..ba962fd 100644 --- a/mods/telex/init.lua +++ b/mods/telex/init.lua @@ -82,12 +82,14 @@ end -- get function telex.get_msg(msgid) if not msgid then + minetest.log("action", "telex: get_msg() called with nil") return nil end local msg = S:get_string(msgid) if msg then return telex.decode(msg) else + minetest.log("action", "telex: get_msg() unable to find " .. msgid) return nil end end @@ -131,6 +133,7 @@ function telex.get(player, no) if not msg then return { "No such message exists." } + minetest.log("action", "telex: get() unable to find msg no " .. no) end return msg @@ -217,7 +220,7 @@ function telex.deliver(msgid, msg) pmeta:set_string("telex_mbox", telex.encode(mbox)) minetest.chat_send_player(msg.to, "You have a new message from <" .. msg.from .. ">, use a terminal to read your messages"); - minetest.log("action", "delivered a message from <" .. msg.from .. "> to <" .. msg.to .. ">") + minetest.log("action", "telex: delivered a message from <" .. msg.from .. "> to <" .. msg.to .. ">") else -- append to spool msg.age = 7 * 86400 -- 7 days max in spool @@ -225,7 +228,7 @@ function telex.deliver(msgid, msg) local spool = telex.decode(S:get_string("telex_spool")) table.insert(spool, msgid) S:set_string("telex_spool", telex.encode(spool)) - minetest.log("action", "spooled a message from <" .. msg.from .. "> to <" .. msg.to .. ">") + minetest.log("action", "telex: spooled a message from <" .. msg.from .. "> to <" .. msg.to .. ">") announce.admins("spooled a message from <" .. msg.from .. "> to <" .. msg.to .. ">") end end @@ -235,7 +238,7 @@ function telex.retour(msgid) local msg = telex.get_msg(msgid) if msg.from == "MAILER-DEAMON" then -- discard, we tried hard enough! - minetest.log("action", "discarded an expired spool message from <" .. msg.from .. "> to <" .. msg.to .. ">") + minetest.log("action", "telex: discarded an expired spool message from <" .. msg.from .. "> to <" .. msg.to .. ">") announce.admins("discarded an expired spool message from <" .. msg.from .. "> to <" .. msg.to .. ">") return end @@ -257,7 +260,7 @@ function telex.retour(msgid) telex.save_msg(msgid2, msg) telex.deliver(msgid2, msg) - minetest.log("action", "returned a message from <" .. from .. "> back to <" .. to .. ">") + minetest.log("action", "telex: returned a message from <" .. from .. "> back to <" .. to .. ">") announce.admins("returned a message from <" .. from .. "> back to <" .. to .. ">") end @@ -329,6 +332,8 @@ minetest.register_on_joinplayer(function(player) end) function telex.process_spool() + minetest.log("action", "telex: process_spool()") + local spool = telex.decode(S:get_string("telex_spool")) local old = {} local del = {} -- 2.11.4.GIT