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

Make the request logging middleware optional #114

Open
duffn opened this issue Mar 17, 2023 · 2 comments
Open

Make the request logging middleware optional #114

duffn opened this issue Mar 17, 2023 · 2 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@duffn
Copy link
Owner

duffn commented Mar 17, 2023

Make this optional with a configuration setting:

# Logging
insert_before Grape::Middleware::Error, GrapeLogging::Middleware::RequestLogger,
{
logger:,
formatter: GrapeLogging::Formatters::Json.new,
include: [GrapeLogging::Loggers::FilterParameters.new([:password])]
}

@duffn duffn added enhancement New feature or request good first issue Good for newcomers labels Mar 17, 2023
@Aaryanpal
Copy link

Hi @duffn ,
Could you please assign so I can resolve this issue. Can u please be little discriptive about this issue and how can I replicate to resolve

@duffn
Copy link
Owner Author

duffn commented Mar 18, 2023

Thanks!

There's no issue really, but only an enhancement.

If you run the project per the README instructions and make a sample request to curl http://localhost:3000/api/v1/hello, you'll see that you get a request log line like

grape-api-boilerplate-app-1  | {"date":"2023-03-18T22:56:13.095+00:00","severity":"INFO","data":{"status":200,"time":{"total":0.74,"db":0,"view":0.74},"method":"GET","path":"/api/v1/hello","params":{},"host":"localhost"}}

This is setup here:

# Logging
insert_before Grape::Middleware::Error, GrapeLogging::Middleware::RequestLogger,
{
logger:,
formatter: GrapeLogging::Formatters::Json.new,
include: [GrapeLogging::Loggers::FilterParameters.new([:password])]
}

I think adding this middleware should be optional. Some users may not want it or it may not be necessary.

The issue is to make this optional using a configuration setting: https://github.com/duffn/grape-api-boilerplate/tree/9e3e423473e273fcedf293ecb02109be59886bd8/config/settings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants