From ff0fea8978cd7974fae9313e6ca6fc7a97ed6f77 Mon Sep 17 00:00:00 2001 From: ancientmarinerdev Date: Tue, 8 Nov 2022 22:27:10 +0000 Subject: [PATCH] Add default logger to make logging easier --- mods/CORE/mcl_util/init.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/mods/CORE/mcl_util/init.lua b/mods/CORE/mcl_util/init.lua index 556b12855..83cc79d22 100644 --- a/mods/CORE/mcl_util/init.lua +++ b/mods/CORE/mcl_util/init.lua @@ -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)