Handle output from hooks appropriately in legacy_formatter

Pass messages and embeddings from hooks to formatters, just before
describing exceptions (is any) to formatters. Update the debug
formatter to also catch puts calls.
Delay output from before hooks in the gherkin_formatter_adapter

Then the JSON formatter will not crash on before hooks output.
TODO: Remove this fix when the JSON formatter (in the Gherkin library)
has been fixed.
Merge pull request #732 "Handle output from hooks appropriately"