-
-
Notifications
You must be signed in to change notification settings - Fork 300
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
Dynamic log level based on http status of request #276
base: master
Are you sure you want to change the base?
Conversation
+1 |
@rbotchek this is a cool idea! Can you rebase on master so CI runs? Would love to get this merged in. |
I'd love to see this feature added. If @rbotchek is not available to rebase it, I'd be happy to take a swing at it. |
@NeilsC go for it! |
Hi @iloveitaly and @NeilsC ... I wasn't ignoring you, but it has been three years without a reply since I created this PR, so I wasn't rushing either. :) Two comments:
Anyway, happy to see that at least a few people are interested in this. And I still think lograge is a great addition to the ecosystem! Glad it's getting some new love! |
Just for a bit of context, I stumbled upon lograge because we're moving to Datadog for APM/logs and they highly recommend lograge to enable structured json logging in Rails. They also have this recommended solution for setting the log level based on the HTTP status of the operation. Their proposed solution looks very similar to what this PR does, so that's why I'm interested in getting it integrated as part of the gem. Anyway, I'll take a stab at it. |
Ha, totally! Just trying to make sure folks in the community feel empowered to make changes and improve here :) Thank you for your extended thoughts! |
+1 |
Lograge is great, but I need the log level to reflect whether or not the request is processed successfully. This PR adds
Lograge.map_log_level
(default false). Whenmap_log_level
is set totrue
, theLograge.log_level
is ignored and the log level is set based on the HTTP status as: