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

Use "insert 0" instead of "use" in README #60

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
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ In your api file (somewhere on the top)
```ruby
require 'grape_logging'
logger.formatter = GrapeLogging::Formatters::Default.new
use GrapeLogging::Middleware::RequestLogger, { logger: logger }
insert 0, GrapeLogging::Middleware::RequestLogger, { logger: logger }
```

**ProTip:** If your logger doesn't support setting formatter you can remove this line - it's optional
Expand Down 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 0, GrapeLogging::Middleware::RequestLogger, logger: logger, formatter: MyFormatter.new
end
```

Expand All @@ -125,7 +125,7 @@ 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 0, GrapeLogging::Middleware::RequestLogger,
logger: logger,
include: [ GrapeLogging::Loggers::Response.new,
GrapeLogging::Loggers::FilterParameters.new,
Expand Down Expand Up @@ -158,7 +158,7 @@ You can control the level used to log. The default is `info`.

```ruby
class MyAPI < Grape::API
use GrapeLogging::Middleware::RequestLogger,
insert 0, GrapeLogging::Middleware::RequestLogger,
logger: logger,
log_level: 'debug'
end
Expand All @@ -170,7 +170,7 @@ 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 0, GrapeLogging::Middleware::RequestLogger,
instrumentation_key: 'grape_key',
include: [ GrapeLogging::Loggers::Response.new,
GrapeLogging::Loggers::FilterParameters.new ]
Expand Down