Closed piotrwodz closed 3 years ago
@ankane Hi Andrew 👋 I am curious about your feedback. This code has been run in two different projects and seems to be working fine :) Sharing with you now.
FYI: I have not yet written any tests.
Hey @piotrwodz, thanks for the PR! I think this feature would be better for Active Record than Logstop (wouldn't need to rely on regular expressions). However, it may be better to disable SQL logging if this is needed, since it won't be able to filter things like:
Lesson.where("week_date = ?", week_date)
Thanks! You found a good example and of course it would need to be filtered as well.
Regarding SQL logging being disabled: of course you can do it. However, Rails has debug mode by design (also in production) and I think, depending on the app you are developing, it makes sense to keep on logging SQL queries. You might still want to inspect these queries but with attributes being filtered.
I think this feature would be better for Active Record than Logstop (wouldn't need to rely on regular expressions).
👍
Enhancement
Closes: https://github.com/ankane/logstop/issues/8
Description
When using
logstop
in Rails and willing to scrub some Active Record attributes from query logs, run this generator:override
scrub_attributes
and enableactive_record
option inguard
method e.g.:Output:
Why should this be added
Add an option of filtering Active Record query logs by passing attribute names.
Checklist