Skip to content

Instantly share code, notes, and snippets.

@kemayo
Created November 13, 2020 15:52
Show Gist options
  • Save kemayo/e3a9c7ec2bf703c152933de10b65412a to your computer and use it in GitHub Desktop.
Save kemayo/e3a9c7ec2bf703c152933de10b65412a to your computer and use it in GitHub Desktop.
local myname, addon = ...
local TextDump = LibStub("LibTextDump-1.0")
addon.debuggable = GetAddOnMetadata(myname, "Version") == '@project-version@'
local _window
local function GetDebugWindow()
if not _window then
_window = TextDump:New(myname)
end
return _window
end
addon.GetDebugWindow = GetDebugWindow
addon.Debug = function(...)
if not addon.debuggable then return end
-- if debugf then debugf:AddMessage(string.join(", ", tostringall(...))) end
GetDebugWindow():AddLine(string.join(', ', tostringall(...)))
end
addon.DebugF = function(...)
if not addon.debuggable then return end
Debug(string.format(...))
end
function addon:ShowDebugWindow()
local window = self.GetDebugWindow()
if window:Lines() == 0 then
window:AddLine("Nothing has happened yet")
window:Display()
window:Clear()
return
end
window:Display()
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment