Add an extension point for exception logging middleware

For use with things like Sentry, Newrelic etc.

For more discussion of this issue see:

https://github.com/ckan/ckan/pull/1799
@morty `'Middleware class {} is missing the method'` won't work in Python 2.6, do you mind changing it to `'Middleware class {0} is missing the method'` for maximum compatibility?