Improve log messages (#422)

- Add log messages wherever required/useful
- Remove unnecessary log messages and print statements
- Convert print statements to minetest.log
- Fix incorrect log level for some messages
- Trivial code-style fixes
This commit is contained in:
ANAND 2019-10-18 11:22:18 +05:30 committed by GitHub
parent 21e7daa183
commit 5eb5d3311a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 71 additions and 49 deletions

View file

@ -114,7 +114,7 @@ function ctf_map.place_outer_barrier(center, r, h)
minp.y = center.y - h / 2
maxp.y = center.y + h / 2
print("Loading data into LVM")
minetest.log("action", "Map maker: Loading data into LVM")
local vm = minetest.get_voxel_manip()
local emin, emax = vm:read_from_map(minp, maxp)
@ -124,7 +124,7 @@ function ctf_map.place_outer_barrier(center, r, h)
}
local data = vm:get_data()
print("Placing left wall")
minetest.log("action", "Map maker: Placing left wall")
-- Left
do
@ -141,7 +141,7 @@ function ctf_map.place_outer_barrier(center, r, h)
end
end
print("Placing right wall")
minetest.log("action", "Map maker: Placing right wall")
-- Right
do
@ -158,7 +158,7 @@ function ctf_map.place_outer_barrier(center, r, h)
end
end
print("Placing front wall")
minetest.log("action", "Map maker: Placing front wall")
-- Front
do
@ -175,7 +175,7 @@ function ctf_map.place_outer_barrier(center, r, h)
end
end
print("Placing back wall")
minetest.log("action", "Map maker: Placing back wall")
-- Back
do
@ -192,7 +192,7 @@ function ctf_map.place_outer_barrier(center, r, h)
end
end
print("Placing bedrock")
minetest.log("action", "Map maker: Placing bedrock")
-- Bedrock
do
@ -204,7 +204,7 @@ function ctf_map.place_outer_barrier(center, r, h)
end
end
print("Placing ceiling")
minetest.log("action", "Map maker: Placing ceiling")
-- Ceiling
do
@ -216,7 +216,7 @@ function ctf_map.place_outer_barrier(center, r, h)
end
end
print("Writing to engine!")
minetest.log("action", "Map maker: Writing to engine!")
vm:set_data(data)
vm:write_to_map(data)

View file

@ -152,6 +152,7 @@ minetest.register_chatcommand("maps", {
send_irc_catalog(name, idx or 1)
end
minetest.log("action", name .. " views the map catalog")
return true
end
})

View file

@ -72,6 +72,7 @@ minetest.register_chatcommand("set_next", {
local idx, map = ctf_map.get_idx_and_map(param)
if idx then
next_idx = idx
minetest.log("action", name .. " selected '" .. map.name .. "' as next map")
return true, "Selected " .. map.name
else
return false, "Couldn't find any matches"
@ -80,7 +81,7 @@ minetest.register_chatcommand("set_next", {
})
local function load_map_meta(idx, path)
print("load_map_meta: Loading map meta from \"" .. path .. "\"")
minetest.log("info", "load_map_meta: Loading map meta from \"" .. path .. "\"")
local conf_path = mapdir .. path .. ".conf"
local offset = vector.new(600 * idx, 0, 0)
local meta = Settings(conf_path)
@ -137,6 +138,7 @@ local function load_map_meta(idx, path)
-- Read custom chest zones from config
i = 1
minetest.log("info", "Parsing chest zones of " .. map.name .. "...")
while meta:get("chests." .. i .. ".from") do
local from = minetest.string_to_pos(meta:get("chests." .. i .. ".from"))
local to = minetest.string_to_pos(meta:get("chests." .. i .. ".to"))
@ -149,7 +151,7 @@ local function load_map_meta(idx, path)
n = tonumber(meta:get("chests." .. i .. ".n") or "23"),
}
minetest.log("warning", dump(map.chests[i]))
minetest.log("info", dump(map.chests[i]))
i = i + 1
end
@ -252,7 +254,7 @@ local function place_map(map)
local seed = minetest.get_mapgen_setting("seed")
for _, chestzone in pairs(ctf_map.map.chests) do
minetest.log("warning", "Placing " .. chestzone.n .. " chests from " ..
minetest.log("info", "Placing " .. chestzone.n .. " chests from " ..
minetest.pos_to_string(chestzone.from) .. " to "..
minetest.pos_to_string(chestzone.to))
place_chests(chestzone.from, chestzone.to, seed, chestzone.n)
@ -340,7 +342,7 @@ ctf_match.register_on_new_match(function()
end
if is_valid then
minetest.log("info",
minetest.log("action",
"ctf_map: Registering treasure - " .. def[1])
treasurer.register_treasure(def[1], def[2], def[3], def[4])
end
@ -362,7 +364,7 @@ function ctf_match.create_teams()
local flag = table.copy(value.pos)
if name and color and flag then
print(" - creating " .. key)
minetest.log("action", "Creating team " .. key)
ctf.team({
name = name,
color = color,
@ -375,7 +377,7 @@ function ctf_match.create_teams()
ctf_flag.assert_flag(flag)
end)
else
minetest.log("error", " - Failed to create " .. key)
minetest.log("error", "Failed to create team " .. key)
end
end
end