Removed console.log and replaced it with the debug module.

I changed the console.log into a debug such that users of this module
can turn debug messages on and off. Also, I've added debug messages
for commit and rollback.