Updates logging code to allow logging of all requests (debug mode) and

a special exceptions mode for only logging to a provided logger calls
that generate exceptions.

This puts a requirement on the logger being passed to implement debug
and/or error functions for debug and exception logging respectively.