Skip to content

Commit

Permalink
- programatic generation of logging functions.
Browse files Browse the repository at this point in the history
- removed unused vars
  • Loading branch information
DerpleMQ2 committed Feb 24, 2024
1 parent 04b3b15 commit e63e2fd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 34 deletions.
17 changes: 5 additions & 12 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,15 @@ RGMercModules = require("utils.rgmercs_modules").load()
require('utils.rgmercs_datatypes')

-- ImGui Variables
local openGUI = true
local shouldDrawGUI = true
local notifyZoning = true
local curState = "Downtime"
local openGUI = true
local shouldDrawGUI = true
local notifyZoning = true
local curState = "Downtime"

-- Icon Rendering
local animItems = mq.FindTextureAnimation("A_DragItem")
local animBox = mq.FindTextureAnimation("A_RecessedBox")
local derpImg = mq.CreateTexture(mq.TLO.Lua.Dir() .. "/rgmercs/extras/derpdog_60.png")
local derpImg = mq.CreateTexture(mq.TLO.Lua.Dir() .. "/rgmercs/extras/derpdog_60.png")

-- Constants
local ICON_WIDTH = 40
local ICON_HEIGHT = 40
local COUNT_X_OFFSET = 39
local COUNT_Y_OFFSET = 23
local EQ_ICON_OFFSET = 500

-- UI --
local function renderModulesTabs()
Expand Down
30 changes: 8 additions & 22 deletions utils/rgmercs_logger.lua
Original file line number Diff line number Diff line change
Expand Up @@ -66,29 +66,15 @@ local function log(logLevel, output, ...)
printf('%s\aw:%s\aw(%s\aw)%s \ax%s', logLeaderStart, logLevels[logLevel].header, callerTracer, logLeaderEnd, output)
end


function actions.log_error(output, ...)
log('error', output, ...)
end

function actions.log_warning(output, ...)
log('warn', output, ...)
end

function actions.log_info(output, ...)
log('info', output, ...)
end

function actions.log_debug(output, ...)
log('debug', output, ...)
end

function actions.log_verbose(output, ...)
log('verbose', output, ...)
function actions.GenerateShortcuts()
for level, _ in pairs(logLevels) do
--- @diagnostic disable-next-line
actions["log_" .. level:lower()] = function(output, ...)
log(level, output, ...)
end
end
end

function actions.log_super_verbose(output, ...)
log('super_verbose', output, ...)
end
actions.GenerateShortcuts()

return actions

0 comments on commit e63e2fd

Please sign in to comment.