From 2139d7d45fb1a8ed250ad96c9975c581f02f72a9 Mon Sep 17 00:00:00 2001 From: ShadowNinja Date: Tue, 13 Oct 2015 03:57:44 -0400 Subject: Refactor logging - Add warning log level - Change debug_log_level setting to enumeration string - Map Irrlicht log events to MT log events - Encapsulate log_* functions and global variables into a class, Logger - Unify dstream with standard logging mechanism - Unify core.debug() with standard core.log() script API --- builtin/game/deprecated.lua | 13 ++++++------- builtin/game/register.lua | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) (limited to 'builtin/game') diff --git a/builtin/game/deprecated.lua b/builtin/game/deprecated.lua index 405e599da..cd1cf5e2d 100644 --- a/builtin/game/deprecated.lua +++ b/builtin/game/deprecated.lua @@ -4,8 +4,7 @@ -- Default material types -- local function digprop_err() - core.log("info", debug.traceback()) - core.log("info", "WARNING: The core.digprop_* functions are obsolete and need to be replaced by item groups.") + core.log("deprecated", "The core.digprop_* functions are obsolete and need to be replaced by item groups.") end core.digprop_constanttime = digprop_err @@ -16,12 +15,12 @@ core.digprop_woodlike = digprop_err core.digprop_leaveslike = digprop_err core.digprop_glasslike = digprop_err -core.node_metadata_inventory_move_allow_all = function() - core.log("info", "WARNING: core.node_metadata_inventory_move_allow_all is obsolete and does nothing.") +function core.node_metadata_inventory_move_allow_all() + core.log("deprecated", "core.node_metadata_inventory_move_allow_all is obsolete and does nothing.") end -core.add_to_creative_inventory = function(itemstring) - core.log('info', "WARNING: core.add_to_creative_inventory: This function is deprecated and does nothing.") +function core.add_to_creative_inventory(itemstring) + core.log("deprecated", "core.add_to_creative_inventory: This function is deprecated and does nothing.") end -- @@ -32,7 +31,7 @@ local envref_deprecation_message_printed = false setmetatable(core.env, { __index = function(table, key) if not envref_deprecation_message_printed then - core.log("info", "WARNING: core.env:[...] is deprecated and should be replaced with core.[...]") + core.log("deprecated", "core.env:[...] is deprecated and should be replaced with core.[...]") envref_deprecation_message_printed = true end local func = core[key] diff --git a/builtin/game/register.lua b/builtin/game/register.lua index d0e04bfc3..840ade127 100644 --- a/builtin/game/register.lua +++ b/builtin/game/register.lua @@ -221,7 +221,7 @@ function core.register_alias(name, convert_to) error("Unable to register alias: Name is forbidden: " .. name) end if core.registered_items[name] ~= nil then - core.log("WARNING: Not registering alias, item with same name" .. + core.log("warning", "Not registering alias, item with same name" .. " is already defined: " .. name .. " -> " .. convert_to) else --core.log("Registering alias: " .. name .. " -> " .. convert_to) -- cgit v1.2.3