Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replaced all 'use' examples in README.md with 'insert_before' #75

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ end
You can change the formatter like so
```ruby
class MyAPI < Grape::API
use GrapeLogging::Middleware::RequestLogger, logger: logger, formatter: MyFormatter.new
insert_before Grape::Middleware::Error, GrapeLogging::Middleware::RequestLogger, logger: logger, formatter: MyFormatter.new
end
```

Expand All @@ -125,7 +125,8 @@ If you prefer some other format I strongly encourage you to do pull request with
You can include logging of other parts of the request / response cycle by including subclasses of `GrapeLogging::Loggers::Base`
```ruby
class MyAPI < Grape::API
use GrapeLogging::Middleware::RequestLogger,
insert_before Grape::Middleware::Error,
GrapeLogging::Middleware::RequestLogger,
logger: logger,
include: [ GrapeLogging::Loggers::Response.new,
GrapeLogging::Loggers::FilterParameters.new,
Expand Down Expand Up @@ -158,7 +159,8 @@ You can control the level used to log. The default is `info`.

```ruby
class MyAPI < Grape::API
use GrapeLogging::Middleware::RequestLogger,
insert_before Grape::Middleware::Error,
GrapeLogging::Middleware::RequestLogger,
logger: logger,
log_level: 'debug'
end
Expand All @@ -170,7 +172,8 @@ You can choose to not pass the logger to ```grape_logging``` but instead send lo
First, config ```grape_logging```, like that:
```ruby
class MyAPI < Grape::API
use GrapeLogging::Middleware::RequestLogger,
insert_before Grape::Middleware::Error,
GrapeLogging::Middleware::RequestLogger,
instrumentation_key: 'grape_key',
include: [ GrapeLogging::Loggers::Response.new,
GrapeLogging::Loggers::FilterParameters.new ]
Expand Down