view Modules/Debug.lua @ 138:7d258c041b11

Fixed an issue with /ia invested that caused all items to display twice. This was introduced by the fix in Ticket 42. At this point ItemAuditor watches mail for auctions sold or purchased, watches for buy/sell (money and 1 item type change) and conversions/tradeskills. Milling isn't working yet because there is too much time between the first event and the last event.
author Asa Ayers <Asa.Ayers@Gmail.com>
date Sat, 02 Oct 2010 20:34:07 -0700
parents e7d287cc3b02
children
line wrap: on
line source
local ItemAuditor = select(2, ...)
local Debug = ItemAuditor:NewModule("Debug")
local ItemAuditor = ItemAuditor

function ItemAuditor:Debug(msg, ...)
	msg = format(msg, ...)
	self:Log(msg, " |cffffff00DEBUG")
end

function ItemAuditor:Log(message, prefix)
	prefix = prefix or ""
	ItemAuditor_DebugFrameTxt:AddMessage(format("%d%s|r: %s", time(), prefix, tostring(message)))
end

function ItemAuditor:GetDebug(info)
       return self.db.profile.messages.debug
end

function ItemAuditor:SetDebug(info, input)
       self.db.profile.messages.debug = input
       local value = "off"
       if input then
               value = "on"
       end
       self:Print("Debugging is now: " .. value)
end

local function DebugEventRegistration()
	ItemAuditor.OriginalRegisterEvent = ItemAuditor.RegisterEvent 
	ItemAuditor.OriginalUnregisterEvent = ItemAuditor.UnregisterEvent

	function ItemAuditor:RegisterEvent(event, callback, arg)
	   self:Debug("RegisterEvent " .. event )
	   if arg ~= nil then
	      ItemAuditor:OriginalRegisterEvent(event, callback, arg)
	   elseif callback ~= nil then
	      ItemAuditor:OriginalRegisterEvent(event, callback)
	   else
	      ItemAuditor:OriginalRegisterEvent(event)
	   end
	end

	function ItemAuditor:UnregisterEvent(event)
		self:Debug("UnregisterEvent " .. event )
		ItemAuditor:OriginalUnregisterEvent (event)
	end

end





-- DebugEventRegistration()