A while back, I actually wrote a session-based logging tool to help snoop when needed.
It's pretty useful, but comes with caveats:
1. It's totally possible to take down your server by logging the entire known universe, since the log is in your session
2. You need to understand how it works, like by refence vs by value, and other behaviors
I've considered putting it up on GitHub, but I really don't have the cycles to support or maintain it.
Sing out if that's of interest to you and I'll think about it.