Quantcast

Added support for tekDebug and converted all existing debug statements.

James D. Callahan III [03-22-10 - 21:49]
Added support for tekDebug and converted all existing debug statements.
Filename
ARL.lua
AckisRecipeList.toc
Frame.lua
Waypoint.lua
diff --git a/ARL.lua b/ARL.lua
index 80cf60a..15e1d00 100644
--- a/ARL.lua
+++ b/ARL.lua
@@ -65,6 +65,8 @@ _G.ARL = addon
 local L		= LibStub("AceLocale-3.0"):GetLocale(MODNAME)
 local BFAC 	= LibStub("LibBabble-Faction-3.0"):GetLookupTable()

+local debugger	= _G.tekDebug and _G.tekDebug:GetFrame(MODNAME)
+
 ------------------------------------------------------------------------------
 -- Constants.
 ------------------------------------------------------------------------------
@@ -143,8 +145,14 @@ if MissingLibraries() then
 	return
 end

-function addon:DEBUG(str, ...)
-	print(string.format(addon:Red("DEBUG: ") .. tostring(str), ...))
+function addon:Debug(...)
+	if debugger then
+		debugger:AddMessage(string.format(...))
+	else
+		--@alpha@
+		self:Printf(...)
+		--@end-alpha@
+	end
 end

 do
diff --git a/AckisRecipeList.toc b/AckisRecipeList.toc
index 1d1ed5e..6f4ca36 100644
--- a/AckisRecipeList.toc
+++ b/AckisRecipeList.toc
@@ -43,7 +43,7 @@
 ## X-Website: http://wow.curse.com/downloads/wow-addons/details/arl.aspx
 ## X-Feedback: http://www.wowace.com/addons/arl/forum/

-## OptionalDeps: Ace3, LibAboutPanel, LibBabble-Zone-3.0, LibBabble-Faction-3.0, LibBabble-Boss-3.0, LibSharedMedia-3.0, LibQTip-1.0, Skillet, ATSW, Manufac, Cauldron, TomTom, TipTac, Carbonite
+## OptionalDeps: Ace3, LibAboutPanel, LibBabble-Zone-3.0, LibBabble-Faction-3.0, LibBabble-Boss-3.0, LibSharedMedia-3.0, LibQTip-1.0, Skillet, ATSW, Manufac, Cauldron, TomTom, TipTac, Carbonite, tekDebug
 ## DefaultState: Enabled

 ## X-WoWI-ID: 5061
diff --git a/Frame.lua b/Frame.lua
index db31555..2da7446 100644
--- a/Frame.lua
+++ b/Frame.lua
@@ -2185,9 +2185,7 @@ do
 		elseif skill_level >= recipe_entry.optimal_level then
 			level_text = string.format(addon:Orange(SKILL_LEVEL_FORMAT), recipe_level)
 		else
-			--@alpha@
-			addon:Printf("DEBUG: Skill level color fallback: %s.", recipe_string)
-			--@end-alpha@
+			addon:Debug("Skill level color fallback: %s.", recipe_string)
 			level_text = string.format(addon:MidGrey(SKILL_LEVEL_FORMAT), recipe_level)
 		end
 		local sort_type = addon.db.profile.sorting
@@ -2437,16 +2435,16 @@ do
 				StaticPopup_Show("ARL_SEARCHFILTERED")
 			else
 				addon:Print(L["NO_DISPLAY"])
-				addon:Print("DEBUG: recipes_total check for 0")
-				addon:Print("DEBUG: recipes_total: " .. Player.recipes_total)
-				addon:Print("DEBUG: recipes_total check for equal to recipes_total")
-				addon:Print("DEBUG: recipes_known: " .. Player.recipes_known)
-				addon:Print("DEBUG: recipes_total: " .. Player.recipes_total)
-				addon:Print("DEBUG: recipes_total_filtered - recipes_known_filtered = 0")
-				addon:Print("DEBUG: recipes_total_filtered: " .. Player.recipes_total_filtered)
-				addon:Print("DEBUG: recipes_known_filtered: " .. Player.recipes_known_filtered)
-				addon:Print("DEBUG: excluded_recipes_unknown ~= 0")
-				addon:Print("DEBUG: excluded_recipes_unknown: " .. Player.excluded_recipes_unknown)
+				addon:Debug("recipes_total check for 0")
+				addon:Debug("recipes_total: " .. Player.recipes_total)
+				addon:Debug("recipes_total check for equal to recipes_total")
+				addon:Debug("recipes_known: " .. Player.recipes_known)
+				addon:Debug("recipes_total: " .. Player.recipes_total)
+				addon:Debug("recipes_total_filtered - recipes_known_filtered = 0")
+				addon:Debug("recipes_total_filtered: " .. Player.recipes_total_filtered)
+				addon:Debug("recipes_known_filtered: " .. Player.recipes_known_filtered)
+				addon:Debug("excluded_recipes_unknown ~= 0")
+				addon:Debug("excluded_recipes_unknown: " .. Player.excluded_recipes_unknown)
 			end
 		end
 	end
diff --git a/Waypoint.lua b/Waypoint.lua
index f69713d..2ad68c0 100644
--- a/Waypoint.lua
+++ b/Waypoint.lua
@@ -500,21 +500,19 @@ function addon:SetupMap(single_recipe)
 			zone = info.loc
 			name = name .. " (" .. location .. ")"
 		else
-			--@alpha@
-			addon:Printf("DEBUG: No continent/zone map match for ID %d. Location: %s.", spell_id, location)
-			--@end-alpha@
+			addon:Debug("No continent/zone map match for ID %d. Location: %s.", spell_id, location)
 		end

 		--@alpha@
 		if (x < -100) or (x > 100) or (y < -100) or (y > 100) then
-			addon:Printf("DEBUG: Invalid location coordinates for ID %d. Location: %s.", spell_id, location)
+			addon:Debug("Invalid location coordinates for ID %d. Location: %s.", spell_id, location)
 		end
 		--@end-alpha@

 		if zone and continent then
 			--@alpha@
 			if x == 0 and y == 0 then
-				addon:Printf("DEBUG: Location is \"0, 0\" for ID %d. Location: %s.", spell_id, location)
+				addon:Debug("Location is \"0, 0\" for ID %d. Location: %s.", spell_id, location)
 			end
 			--@end-alpha@
 			local iconuid = TomTom:AddZWaypoint(continent, zone, x, y, name, false, minimap, worldmap)