Added pluggable log function

This is a critical library and hard to debug. Having been able to get logs from it should
decrease time required to debug the code when using with another service.