Add mod name to all minetest.log messages

master
Wuzzy 2022-05-06 10:22:29 +02:00
parent c8f1ff2acf
commit 9ddd2539b4
6 changed files with 14 additions and 14 deletions

View File

@ -37,7 +37,7 @@ crafting.default_craftdef = {
function crafting.register_craft(def)
if def.output == nil then
minetest.log("warning",
"No output for craft recipe")
"[rp_crafting] No output for craft recipe")
return
end
@ -50,7 +50,7 @@ function crafting.register_craft(def)
if not minetest.registered_items[itemstack:get_name()] then
minetest.log("warning",
"Trying to register craft " .. itemkey
"[rp_crafting] Trying to register craft " .. itemkey
.. " that has an unknown output item")
end
@ -62,7 +62,7 @@ function crafting.register_craft(def)
if #craftdef.items > crafting.max_inputs then
minetest.log("warning",
"Attempting to register craft " .. itemkey .." with more than "
"[rp_crafting] Attempting to register craft " .. itemkey .." with more than "
.. crafting.max_inputs .. " inputs, allowing")
end
@ -74,7 +74,7 @@ function crafting.register_craft(def)
crafting.registered_crafts[itemkey] = craftdef
minetest.log("info", "Registered recipe for " .. itemkey)
minetest.log("info", "[rp_crafting] Registered recipe for " .. itemkey)
end
function crafting.get_crafts(player_inventory, player_name)
@ -162,7 +162,7 @@ function crafting.craft(player, wanted, wanted_count, output, items)
if craftdef == nil then
minetest.log("warning",
"Tried to craft an unregistered item " .. wanted:to_string())
"[rp_crafting] Tried to craft an unregistered item " .. wanted:to_string())
return nil
end

View File

@ -46,7 +46,7 @@ local function create_creative_inventory(player)
end,
on_take = function(inv, listname, index, stack, player)
if stack then
minetest.log("action", player:get_player_name().." takes "..dump(stack:get_name()).." from creative inventory")
minetest.log("action", "[rp_creative] " .. player:get_player_name().." takes "..dump(stack:get_name()).." from creative inventory")
end
end,
}, player_name)

View File

@ -21,7 +21,7 @@ local on_receive_fields = function(pos, formname, fields, sender)
if string.len(text) > SIGN_MAX_TEXT_LENGTH then
text = string.sub(text, 1, SIGN_MAX_TEXT_LENGTH)
end
minetest.log("action", (sender:get_player_name() or "")..
minetest.log("action", "[rp_default] " .. (sender:get_player_name() or "")..
" wrote \""..text.."\" to sign at "..
minetest.pos_to_string(pos))
meta:set_string("text", text)

View File

@ -94,7 +94,7 @@ function jewels.register_jewel(toolname, new_toolname, def)
if not tooldef then
minetest.log("warning",
"Trying to register jewel " .. new_toolname
"[rp_jewels] Trying to register jewel " .. new_toolname
.. " that has an unknown output item " .. toolname)
return

View File

@ -11,7 +11,7 @@ function partialblocks.register_material(name, desc_slab, desc_stair, node, grou
local nodedef = minetest.registered_nodes[node]
if nodedef == nil then
minetest.log("warning", "Cannot find node for partialblock: " .. node)
minetest.log("warning", "[rp_partialblocks] Cannot find node for partialblock: " .. node)
return
end

View File

@ -11,29 +11,29 @@ if minetest.settings:get_bool("testing_enable") then
for i = 1, 10000 do
dump({x=0,y=50,z=100})
end
minetest.log("action", string.format("10000 iterations with dump({x=0,y=50,z=100}) took %.2fms", (os.clock() - t1) * 1000))
minetest.log("action", "[rp_testing] " .. string.format("10000 iterations with dump({x=0,y=50,z=100}) took %.2fms", (os.clock() - t1) * 1000))
local t2 = os.clock()
for i = 1, 10000 do
tostring({x=0,y=50,z=100})
end
minetest.log("action", string.format("10000 iterations with tostring({x=0,y=50,z=100}) took %.2fms", (os.clock() - t2) * 1000))
minetest.log("action", "[rp_testing] " .. string.format("10000 iterations with tostring({x=0,y=50,z=100}) took %.2fms", (os.clock() - t2) * 1000))
local t3 = os.clock()
for i = 1, 10000 do
minetest.serialize({x=0,y=50,z=100})
end
minetest.log("action", string.format("10000 iterations with minetest.serialize({x=0,y=50,z=100}) took %.2fms", (os.clock() - t3) * 1000))
minetest.log("action", "[rp_testing] " .. string.format("10000 iterations with minetest.serialize({x=0,y=50,z=100}) took %.2fms", (os.clock() - t3) * 1000))
local t4 = os.clock()
for i = 1, 10000 do
dumpvec({x=0,y=50,z=100})
end
minetest.log("action", string.format("10000 iterations with (custom function) dumpvec({x=0,y=50,z=100}) took %.2fms", (os.clock() - t4) * 1000))
minetest.log("action", "[rp_testing] " .. string.format("10000 iterations with (custom function) dumpvec({x=0,y=50,z=100}) took %.2fms", (os.clock() - t4) * 1000))
local t5 = os.clock()
for i = 1, 10000 do
minetest.hash_node_position({x=0,y=50,z=100})
end
minetest.log("action", string.format("10000 iterations with minetest.hash_node_position({x=0,y=50,z=100}) took %.2fms", (os.clock() - t5) * 1000))
minetest.log("action", "[rp_testing] " .. string.format("10000 iterations with minetest.hash_node_position({x=0,y=50,z=100}) took %.2fms", (os.clock() - t5) * 1000))
end