Suppress request strategy log messages for every request #543
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Right now all requests are being wrapped with
Chewy.strategy(Chewy.request_strategy) { @app.call(env) }
. So every request will have two log entries for defaultChewy.request_strategy
added and removed from stack.Here's what current log looks like:
Since most developers are aware of their
Chewy.request_strategy
setting, there's no much need to remind them about it each time. So I decided to add a log message which will appear on server load (added torailties.rb
). Also I've removedDEBUG:
portion of a message because it's quite obvious anyway, and it is a responsibility ofLogger::Formatter
to format logs.This is what it looks like now:
For every request that doesn't change strategy, it will not show any strategy messages:
I have also added a
now
message when a strategy is removed from stack - that makes it much easier to follow strategy changes. And here's what happens if we wrap controller action withChewy.strategy(:bypass)
block:That
now atomic
message shows which strategy will be used after bypass is removed from stack.Please let me know if that makes sense.