Logging

This adds some logging stuff to the API, so that logs are a little easier to read.