Use debug logging instead of print statements.

No need to pass around a debug param, and we can turn it on/off globally
instead.