Undo changes to README since it relies on unpublished changes in Grape

This commit is contained in:
Ryan Buckley 2016-05-12 19:52:54 +08:00
parent c5ba92d9bd
commit 303bf5510b
1 changed files with 2 additions and 11 deletions

View File

@ -23,8 +23,8 @@ gem 'grape-middleware-logger'
## Usage ## Usage
```ruby ```ruby
class API < Grape::API class API < Grape::API
# @note Make sure this is above you're first +mount+ # @note Make sure this above you're first +mount+
insert_after Grape::Middleware::Formatter, Grape::Middleware::Logger use Grape::Middleware::Logger
end end
``` ```
@ -54,15 +54,6 @@ The middleware logger can be customized with the following options:
* The `:logger` option can be any object that responds to `.info(String)` * The `:logger` option can be any object that responds to `.info(String)`
* The `:filter` option can be any object that responds to `.filter(Hash)` and returns a hash. * The `:filter` option can be any object that responds to `.filter(Hash)` and returns a hash.
For example:
```ruby
insert_after Grape::Middleware::Formatter, Grape::Middleware::Logger, {
logger: Logger.new(STDERR),
filter: Class.new { def filter(opts) opts.reject { |k, _| k.to_s == 'password' } end }.new
}
```
## Using Rails? ## Using Rails?
`Rails.logger` and `Rails.application.config.filter_parameters` will be used automatically as the default logger and `Rails.logger` and `Rails.application.config.filter_parameters` will be used automatically as the default logger and
param filterer, respectively. This behavior can be overridden by passing the `:logger` or param filterer, respectively. This behavior can be overridden by passing the `:logger` or