Add custom logger support. Refactor response error handling. Clean code to follow reek style guide.

does this also log the request query?