annotate Modules/Debug.lua @ 121:f7efbd879062

Update GetItemCost to return the total invested even if you have none of that item left. If you sell all of an item but are waiting for the mail to arrive, you can still see how much you have invested even though you don't actually own any more of that item.
author Asa Ayers <Asa.Ayers@Gmail.com>
date Thu, 02 Sep 2010 21:40:08 -0700
parents e7d287cc3b02
children
rev   line source
Asa@63 1 local ItemAuditor = select(2, ...)
Asa@63 2 local Debug = ItemAuditor:NewModule("Debug")
Asa@63 3 local ItemAuditor = ItemAuditor
Asa@3 4
Asa@63 5 function ItemAuditor:Debug(msg, ...)
Asa@24 6 msg = format(msg, ...)
Asa@22 7 self:Log(msg, " |cffffff00DEBUG")
Asa@22 8 end
Asa@22 9
Asa@63 10 function ItemAuditor:Log(message, prefix)
Asa@22 11 prefix = prefix or ""
Asa@22 12 ItemAuditor_DebugFrameTxt:AddMessage(format("%d%s|r: %s", time(), prefix, tostring(message)))
Asa@3 13 end
Asa@3 14
Asa@63 15 function ItemAuditor:GetDebug(info)
Asa@16 16 return self.db.profile.messages.debug
Asa@16 17 end
Asa@16 18
Asa@63 19 function ItemAuditor:SetDebug(info, input)
Asa@16 20 self.db.profile.messages.debug = input
Asa@16 21 local value = "off"
Asa@16 22 if input then
Asa@16 23 value = "on"
Asa@16 24 end
Asa@16 25 self:Print("Debugging is now: " .. value)
Asa@16 26 end
Asa@16 27
Asa@3 28 local function DebugEventRegistration()
Asa@63 29 ItemAuditor.OriginalRegisterEvent = ItemAuditor.RegisterEvent
Asa@63 30 ItemAuditor.OriginalUnregisterEvent = ItemAuditor.UnregisterEvent
Asa@3 31
Asa@63 32 function ItemAuditor:RegisterEvent(event, callback, arg)
Asa@3 33 self:Debug("RegisterEvent " .. event )
Asa@3 34 if arg ~= nil then
Asa@63 35 ItemAuditor:OriginalRegisterEvent(event, callback, arg)
Asa@3 36 elseif callback ~= nil then
Asa@63 37 ItemAuditor:OriginalRegisterEvent(event, callback)
Asa@3 38 else
Asa@63 39 ItemAuditor:OriginalRegisterEvent(event)
Asa@3 40 end
Asa@3 41 end
Asa@3 42
Asa@63 43 function ItemAuditor:UnregisterEvent(event)
Asa@3 44 self:Debug("UnregisterEvent " .. event )
Asa@63 45 ItemAuditor:OriginalUnregisterEvent (event)
Asa@3 46 end
Asa@3 47
Asa@3 48 end
Asa@3 49
Asa@3 50
Asa@3 51
Asa@3 52
Asa@3 53
Asa@7 54 -- DebugEventRegistration()