added a bit of logging to api