Go to file
Ryan Buckley f99aff93c6 add .ruby-version to .gitignore 2015-05-09 14:20:21 -07:00
lib/grape/middleware be more positive 2015-05-09 02:11:28 -07:00
spec use +before+ because it works on Grape master 2015-05-05 22:42:17 -07:00
.gitignore add .ruby-version to .gitignore 2015-05-09 14:20:21 -07:00
Gemfile Launch this thingy 😅 2015-05-05 20:20:23 -07:00
LICENSE.txt Launch this thingy 😅 2015-05-05 20:20:23 -07:00
README.md Update README.md 2015-05-05 22:53:58 -07:00
Rakefile Specs and update to handle broken state of Grape Globals 2015-05-05 22:22:35 -07:00
grape-middleware-logger.gemspec update gemspec description 2015-05-09 12:34:00 -07:00

README.md

Grape::Middleware::Logger

Works if you're running directly off Grape master. Otherwise, you'll have to wait for the release of Grape v0.12.0

Installation

Add this line to your application's Gemfile:

gem 'grape-middleware-logger'

And then execute:

$ bundle

Or install it yourself as:

$ gem install grape-middleware-logger

Usage

class API < Grape::API
  use Grape::Middleware::Logger
end

Using Grape with Rails? Add consistent logging and param filtering with

use Grape::Middleware::Logger, { 
  logger: Rails.logger, 
  filter: ActionDispatch::Http::ParameterFilter.new(Rails.application.config.filter_parameters)
}

Credits

Big thanks to jadent's question/answer on stackoverflow for easily logging error responses. Borrowed some motivation from the grape_logging gem and would love to see these two consolidated at some point.

Contributing

  1. Fork it ( https://github.com/ridiculous/grape-middleware-logger/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request