Real logging, please incorporate into new and existing code.

The other pull request was getting stale (I couldn't even pull the new changes successfully). I think just merging debug.py and moving to the new logging deal over time is a better. (I don't think we'll ever catch up otherwise)