Add default logger to make logging easier

This commit is contained in:
ancientmarinerdev 2022-11-08 22:27:10 +00:00 committed by cora
parent 814ad39c09
commit ff0fea8978

View file

@ -22,6 +22,19 @@ function table.update_nil(t, ...)
return t
end
local LOGGING_ON = minetest.settings:get_bool("mcl_logging_default",false)
local LOG_MODULE = "[MCL2]"
function mcl_util.mcl_log (message, module)
local selected_module = LOG_MODULE
if module then
selected_module = module
end
if LOGGING_ON and message then
minetest.log(selected_module .. " " .. message)
end
end
function mcl_util.file_exists(name)
if type(name) ~= "string" then return end
local f = io.open(name)