Pass `doc` to `on_before_dispatch`

This allows users to log outgoing documents before they are sent.

This may break backwards compatibility by changing the arity of `on_before_dispatch`, but we couldn't get the tests to run via `rake test` so we're unsure of how to test that we're not breaking every existing implementation.