got rid of further minetest.log and used own logging

This commit is contained in:
Sokomine 2022-09-10 01:00:56 +02:00
parent f514acd3bc
commit dc80271803
4 changed files with 21 additions and 19 deletions

View File

@ -440,12 +440,14 @@ yl_speak_up.load_generic_dialogs = function()
local dialog = yl_speak_up.load_dialog(n_id, false) local dialog = yl_speak_up.load_dialog(n_id, false)
local res = yl_speak_up.check_and_add_as_generic_dialog(dialog, n_id) local res = yl_speak_up.check_and_add_as_generic_dialog(dialog, n_id)
if(res == "OK") then if(res == "OK") then
minetest.log("action", "[MOD] yl_speak_up: ".. yl_speak_up.log_change("-", n_id,
"Generic dialog from NPC "..tostring(n_id).." loaded successfully.") "Generic dialog from NPC "..tostring(n_id).." loaded successfully.",
"action")
else else
minetest.log("action", "[MOD] yl_speak_up: ".. yl_speak_up.log_change("-", n_id,
"Generic dialog from NPC "..tostring(n_id).." failed to load: ".. "Generic dialog from NPC "..tostring(n_id).." failed to load: "..
tostring(res)..".") tostring(res)..".",
"action")
end end
end end
end end

View File

@ -267,9 +267,11 @@ yl_speak_up.show_fs_decorated = function(pname, edit_mode, h,
elseif(allow_scrolling) then elseif(allow_scrolling) then
if(fs_version < 2) then if(fs_version < 2) then
-- if the player has an older formspec version -- if the player has an older formspec version
minetest.log( "info", -- (the NPC itself is not relevant, and players reading the NPC logfile don't
"[MOD] yl_speak_up: User " .. pname .. " talked to NPC ID n_" .. n_id .. -- need this information)
" with an old formspec version!") yl_speak_up.log_change(pname, nil,
"User " .. pname .. " talked to NPC ID n_" .. n_id ..
" with an old formspec version!", "info")
table.insert(formspec, table.insert(formspec,
"box[0.3,20;19,2.6;red]".. "box[0.3,20;19,2.6;red]"..
"label[0.7,20.3;"..yl_speak_up.text_version_warning.."]") "label[0.7,20.3;"..yl_speak_up.text_version_warning.."]")

View File

@ -51,22 +51,17 @@ function yl_speak_up.on_spawn(self)
self.tamed = true self.tamed = true
self.object:set_armor_groups({immortal = 100}) self.object:set_armor_groups({immortal = 100})
minetest.log( yl_speak_up.log_change("-", "n_"..self.yl_speak_up.id,
"action", "spawned at "..minetest.pos_to_string(self.object:get_pos()), "action")
"[MOD] yl_speak_up: NPC with ID n_" ..
self.yl_speak_up.id .. " spawned at " .. minetest.pos_to_string(self.object:get_pos(), 0)
)
--Let's do it only once --Let's do it only once
return true return true
end end
function yl_speak_up.after_activate(self, staticdata, def, dtime) function yl_speak_up.after_activate(self, staticdata, def, dtime)
-- minetest.log( -- this scrolls far too much
-- "action", -- yl_speak_up.log_change("-", "n_"..self.yl_speak_up.id,
-- "[MOD] yl_speak_up: NPC with ID n_" .. -- "activated at "..minetest.pos_to_string(self.object:get_pos()), "action")
-- self.yl_speak_up.id .. " activated at " .. minetest.pos_to_string(self.object:get_pos(), 0)
-- )
if yl_speak_up.status == 2 then if yl_speak_up.status == 2 then
self.object:remove() self.object:remove()

View File

@ -5,9 +5,12 @@ yl_speak_up.allow_staff_use = function(itemstack, user, pointed_thing)
if not has_priv then if not has_priv then
minetest.chat_send_player(p_name,yl_speak_up.message_tool_taken_because_of_lacking_priv) minetest.chat_send_player(p_name,yl_speak_up.message_tool_taken_because_of_lacking_priv)
minetest.log("action","[MOD] yl_speak_up: User "..p_name.. -- no special NPC involved
yl_speak_up.log_change(p_name, nil,
"User "..p_name..
" used an admin item: "..itemstack:get_name().. " used an admin item: "..itemstack:get_name()..
" at pos "..minetest.pos_to_string(user:get_pos(),0)) " at pos "..minetest.pos_to_string(user:get_pos(),0),
"action")
itemstack:take_item(1) itemstack:take_item(1)
return return
end end