Add levels to log messages

This commit is contained in:
Yaman Qalieh 2020-05-27 14:04:00 -04:00
parent 11438a1625
commit a8147e9875
15 changed files with 17 additions and 17 deletions

View File

@ -20,7 +20,7 @@ function nodecore.digparticles(nodedef, partdef)
elseif nodedef.inventory_image then
img[1] = nodedef.inventory_image
end
if #img < 1 then return minetest.log("no pummel tile images found!") end
if #img < 1 then return minetest.log("error", "no pummel tile images found!") end
img = nodecore.pickrand(img)
if img.name then img = img.name end

View File

@ -12,7 +12,7 @@ minetest.after(0, function()
for k in pairs(missing) do t[#t + 1] = k end
if #t < 1 then return end
table_sort(t)
minetest.log("WARNING: missing txp override images:\n\t"
minetest.log("warning", "WARNING: missing txp override images:\n\t"
.. table_concat(t, "\n\t"))
end)

View File

@ -14,5 +14,5 @@ local limitchunks = math_floor(limit / chunksize)
nodecore.map_limit_min = (-limitchunks + 0.5) * chunksize + 7.5
nodecore.map_limit_max = (limitchunks - 0.5) * chunksize + 7.5
minetest.log(string_format("mapgen limit: %d, chunk: %d, bounds: %0.1f to %0.1f",
minetest.log("info", string_format("mapgen limit: %d, chunk: %d, bounds: %0.1f to %0.1f",
limit, chunksize, nodecore.map_limit_min, nodecore.map_limit_max))

View File

@ -9,12 +9,12 @@ minetest.register_globalstep(function(dtime)
local mtt = minetest.get_gametime()
local nct = nodecore.gametime
if not nct then
minetest.log("nodecore.gametime: init to " .. mtt)
minetest.log("info", "nodecore.gametime: init to " .. mtt)
nct = mtt
end
nct = nct + dtime
if math_abs(nct - mtt) >= 2 then
minetest.log("nodecore.gametime: excess drift; nct="
minetest.log("info", "nodecore.gametime: excess drift; nct="
.. nct .. ", mtt=" .. mtt)
nct = mtt
end

View File

@ -310,7 +310,7 @@ function nodecore.node_spin_custom(...)
node = node or minetest.get_node(pos)
node.param2 = lut[node.param2] or lut[false]
if clicker:is_player() then
minetest.log(clicker:get_player_name() .. " spins "
minetest.log("action", clicker:get_player_name() .. " spins "
.. node.name .. " at " .. minetest.pos_to_string(pos)
.. " to param2 " .. node.param2 .. " ("
.. qty .. " total)")

View File

@ -49,7 +49,7 @@ minetest.after(0, function()
defs = defs + n
if n > peak then peak = n end
end
minetest.log(string_format("register_aism: %d keys, %d defs, %d peak", keys, defs, peak))
minetest.log("info", string_format("register_aism: %d keys, %d defs, %d peak", keys, defs, peak))
end)
local function checkrun(def, stack, data)

View File

@ -67,7 +67,7 @@ nodecore.register_limited_abm({
action = function(pos)
local time = active_lights[minetest.hash_node_position(pos)] or 0
if time >= nodecore.gametime - 2 then return end
minetest.log("dynalight cleaned up at " .. minetest.pos_to_string(pos))
minetest.log("info", "dynalight cleaned up at " .. minetest.pos_to_string(pos))
return minetest.remove_node(pos)
end
})

View File

@ -50,7 +50,7 @@ function nodecore.register_limited_abm(def)
pumpq)
if def.limited_qty >= def.limited_alert then
minetest.log("limited abm \"" .. def.label .. "\" filled ("
minetest.log("info", "limited abm \"" .. def.label .. "\" filled ("
.. def.limited_qty .. "/" .. def.limited_max .. ")")
end

View File

@ -137,7 +137,7 @@ local function craftcheck(recipe, pos, node, data, xx, xz, zx, zz)
function(p) return lut[minetest.hash_node_position(p)] end
)
end
minetest.log((data.crafter and data.crafter:get_player_name() or "unknown")
minetest.log("action", (data.crafter and data.crafter:get_player_name() or "unknown")
.. " completed recipe \"" .. recipe.label .. "\" at " ..
minetest.pos_to_string(pos) .. " upon " .. node.name)
return true

View File

@ -52,7 +52,7 @@ end
tryhook()
function nodecore.ent_prop_set(obj, def)
minetest.log("WARNING: nodecore.ent_prop_set() is now deprecated;"
minetest.log("warning", "WARNING: nodecore.ent_prop_set() is now deprecated;"
.. " just use object:set_properties(), which has been patched")
return obj:set_properties(def)
end

View File

@ -125,7 +125,7 @@ for k in pairs({
register_concrete_pattern = true,
register_concrete_etchable = true
}) do
minetest.log(k)
minetest.log("info", k)
local old = nodecore[k];
rawset(nodecore, k, function(...)
local function helper(...)

View File

@ -50,7 +50,7 @@ local function handlepickups(player)
v = nodecore.stack_merge(snap[j], v)
end
if not v:is_empty() then
minetest.log("failed to reinsert item "
minetest.log("error", "failed to reinsert item "
.. v:get_name() .. " " .. v:get_count()
.. " for " .. pname)
dirty = nil
@ -67,7 +67,7 @@ local function handlepickups(player)
end
if dirty then
minetest.log("inventory rearranged for " .. pname)
minetest.log("info", "inventory rearranged for " .. pname)
inv:set_list("main", snap)
end
end

View File

@ -75,7 +75,7 @@ local function playeradd(qty, player, ...)
end
if qty ~= 0 and dbadd(qty, pname, ...) <= qty then
local t = {...}
minetest.log(string_format("player %q discovered %q",
minetest.log("action", string_format("player %q discovered %q",
pname, table_concat(t, ":")))
for _, v in pairs(nodecore.registered_on_player_discovers) do
v(player, t)

View File

@ -36,7 +36,7 @@ minetest.register_node(modname .. ":eggcorn", {
if nodecore.player_stat_add then
nodecore.player_stat_add(1, whom, "craft", "eggcorn planting")
end
minetest.log((whom and whom:get_player_name() or "unknown")
minetest.log("action", (whom and whom:get_player_name() or "unknown")
.. " planted an eggcorn at " .. minetest.pos_to_string(pos))
stack:set_count(stack:get_count() - 1)

View File

@ -52,7 +52,7 @@ end
local function matching(pa, na, pb, nb)
if stackonly[na.name] then
if not stackonly[nb.name] then return end
minetest.log(nodecore.stack_get(pa):get_name() .. " ?= "
minetest.log("info", nodecore.stack_get(pa):get_name() .. " ?= "
.. nodecore.stack_get(pb):get_name())
return (laststack and laststack:get_name()) == nodecore.stack_get(pb):get_name()
end