Something we have started to do is in our globals.lua we have these functions
function print_line(...)
print(debug.getinfo(2).short_src .. ":" .. debug.getinfo(2).currentline)
print(...)
end
function pprint_line(...)
print(debug.getinfo(2).short_src .. ":" .. debug.getinfo(2).currentline)
pprint(...)
end
We now use these instead of the normal print / pprint generally as first they have a clickable link in the console to go to the line in the file that is printing, and second when hunting for prints that are not needed anymore it is much easier to find where they are instead of trying to search through files where there may be many commented prints.
You can also monkey patch the builtin prints with these versions to find stray prints.