header
logo

PrintTracer

Install

PrintTracer hooks the print function in order to display the source of print function calls.  This can help if you have some spammy debug text in your chat window and you don't know what addon is writing it.  Here's the full code.

local oldprint = print
print = function(text, ...)
    text = tostring(text)
    for n=1,select('#', ...) do
        local e = select(n, ...)
        text = text.." "..tostring(e)
    end
    local source = gsub(strtrim(debugstack(2,1,0),".\n"),"Interface\\AddOns\\","")
    text = "PT: print(\""..text.."\") called from "..source
    return oldprint(text)
end