Logging

This is a squashed version of the other logging I'd done, with some fixes Dan had mentioned and also without the coffee-script changes