Logging

@cgustafson here are the changes for PHPAPI-18.