Mercurial > wow > ouroloot
diff 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 |
line wrap: on
line diff
--- a/core.lua Fri Jan 20 10:46:58 2012 +0000 +++ b/core.lua Fri Jan 20 11:48:38 2012 +0000 @@ -104,6 +104,15 @@ identTg = "OuroLoot2Tg" status_text = nil + tekdebug = nil + if _G.tekDebug then + local tdframe = _G.tekDebug:GetFrame("Ouro Loot") + function tekdebug (txt) + -- tekDebug notices "<name passed to getframe>|r:" + tdframe:AddMessage('|cff17ff0dOuro Loot|r:'..txt,1,1,1) + end + end + DEBUG_PRINT = false debug = { comm = false, @@ -113,18 +122,31 @@ cache = false, alsolog = false, } - function dprint (t,...) - if DEBUG_PRINT and debug[t] then - local text = flib.safeprint("<"..t.."> ",...) - if debug.alsolog then - addon:log_with_timestamp(text) + -- This looks ugly, but it factors out the load-time decisions from + -- the run-time ones. + if tekdebug then + function dprint (t,...) + if DEBUG_PRINT and debug[t] then + local text = flib.safefprint(tekdebug,"<"..t.."> ",...) + if debug.alsolog then + addon:log_with_timestamp(text) + end + end + end + else + function dprint (t,...) + if DEBUG_PRINT and debug[t] then + local text = flib.safeprint("<"..t.."> ",...) + if debug.alsolog then + addon:log_with_timestamp(text) + end end end end - if author_debug then - function pprint(t,...) - local text = flib.safeprint("<<"..t..">> ",...) + if author_debug and tekdebug then + function pprint (t,...) + local text = flib.safefprint(tekdebug,"<<"..t..">> ",...) if debug.alsolog then addon:log_with_timestamp(text) end