1
0
Fork 0

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
1 changed files with 13 additions and 0 deletions

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)