comparison core.lua @ 45:1001dd95dbeb

If tekDebug is found, feed debugging messages there instead of print(); 'alsolog' functionality unchanged.
author Farmbuyer of US-Kilrogg <farmbuyer@gmail.com>
date Fri, 20 Jan 2012 11:48:38 +0000
parents a561a967b5e6
children 1070a14cfee4
comparison
equal deleted inserted replaced
44:a561a967b5e6 45:1001dd95dbeb
102 revision = _G.GetAddOnMetadata(nametag,"Version") or "?" -- "x.yy.z", etc 102 revision = _G.GetAddOnMetadata(nametag,"Version") or "?" -- "x.yy.z", etc
103 ident = "OuroLoot2" 103 ident = "OuroLoot2"
104 identTg = "OuroLoot2Tg" 104 identTg = "OuroLoot2Tg"
105 status_text = nil 105 status_text = nil
106 106
107 tekdebug = nil
108 if _G.tekDebug then
109 local tdframe = _G.tekDebug:GetFrame("Ouro Loot")
110 function tekdebug (txt)
111 -- tekDebug notices "<name passed to getframe>|r:"
112 tdframe:AddMessage('|cff17ff0dOuro Loot|r:'..txt,1,1,1)
113 end
114 end
115
107 DEBUG_PRINT = false 116 DEBUG_PRINT = false
108 debug = { 117 debug = {
109 comm = false, 118 comm = false,
110 loot = false, 119 loot = false,
111 flow = false, 120 flow = false,
112 notraid = false, 121 notraid = false,
113 cache = false, 122 cache = false,
114 alsolog = false, 123 alsolog = false,
115 } 124 }
116 function dprint (t,...) 125 -- This looks ugly, but it factors out the load-time decisions from
117 if DEBUG_PRINT and debug[t] then 126 -- the run-time ones.
118 local text = flib.safeprint("<"..t.."> ",...) 127 if tekdebug then
119 if debug.alsolog then 128 function dprint (t,...)
120 addon:log_with_timestamp(text) 129 if DEBUG_PRINT and debug[t] then
121 end 130 local text = flib.safefprint(tekdebug,"<"..t.."> ",...)
122 end 131 if debug.alsolog then
123 end 132 addon:log_with_timestamp(text)
124 133 end
125 if author_debug then 134 end
126 function pprint(t,...) 135 end
127 local text = flib.safeprint("<<"..t..">> ",...) 136 else
137 function dprint (t,...)
138 if DEBUG_PRINT and debug[t] then
139 local text = flib.safeprint("<"..t.."> ",...)
140 if debug.alsolog then
141 addon:log_with_timestamp(text)
142 end
143 end
144 end
145 end
146
147 if author_debug and tekdebug then
148 function pprint (t,...)
149 local text = flib.safefprint(tekdebug,"<<"..t..">> ",...)
128 if debug.alsolog then 150 if debug.alsolog then
129 addon:log_with_timestamp(text) 151 addon:log_with_timestamp(text)
130 end 152 end
131 end 153 end
132 else 154 else