What is the easiest way to record function calls for debugging in Python? I'm usually interested in particular functions or all functions from a given class. Or sometimes even all functions called on a particular object attribute. Seeing the call arguments would be useful, too.
I can imagine writing decorators for all that, but then I'd still have to modify the source code in different places. And writing a class decorator which modifies all methods isn't that straightforward.
Is there a solution where I don't have to modify my source code? Ideally something which doesn't slow down Python too much.
objectitself when in 'debug mode' and reconfigure__getattribute__,__setattr__, and maybe__call__, then use some sort of filtering mechanism to define which things you want to log and which not. Though @StevenRumbalski's question deserves answering first.