Skip to content

Conversation

ridiculous
Copy link
Owner

This approach duck punches the Rack::Head middleware to log the status code of the response. This is the first middleware in the Grape stack. The patching risk is deemed low because of the likely hood of change; it implements the established interface for #call.

Summary of how it works now:

  1. The logger class adds the logging info to a string object
  2. The string object and the given logger (or default) are passed along in the env hash
  3. The override to Rack::Head#call uses the logger to finish the request message with the finished response

@ridiculous ridiculous changed the title Log the actual status code of the response [POC] Log the actual status code of the response Sep 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant