Closed codebycliff closed 5 years ago
for anyone else out there, I wrote a hack fix by adding this line to my config.rb file:
config.rails_semantic_logger.define_singleton_method(:filter) { nil }
i figured I would leave this in until a fix is decided on. will be watching this issue for updates
It looks like the way to fix this is to replace the use of the ordered hash with a custom module / class that has the necessary accessors. I wonder if maybe even a Struct would work in its place? https://github.com/rocketjob/rails_semantic_logger/blob/997e7cbae134e18d9787ae83f464e7a6bac798f3/lib/rails_semantic_logger/engine.rb#L21
That seems like an appropriate change to me, though I don't have a ton of context on the gem's source code. Are you going to be able to get around to it, or will you need some help from us?
Thanks for the fix! Any chance at getting a release cut?
Gem v4.3.4 has been published with this fix
Environment
Expected Behavior
The application should should be able to find and access the
development.log
file.Actual Behavior
Semantic logger raises an exception (i.e.
Exception: RuntimeError: :filter must be a Regexp or Proc
) because the value offilter
is anEnumerable
. We tracked this back to the addition ofEnumerable#filter
in Ruby 2.6.0. SinceHash
includesEnumerable
andActiveSupport::OrderedOptions
extendsHash
, the value offilter
ends up being result of theEnumerable#filter
method, not thefilter
configuration value. You can see this by immediately examining the value offilter
right after it is set here.Pull Request
We have consider a couple different solutions, but we aren't quite positive the impacts. Obviously changing the
filter
configuration value name is the easiest, but at the same time the most breaking change that could be made. We'll await guidance from you before sketching out a pull request.On another note, now that Ruby 2.6.0 is stable, should we be testing against it without allowing failures? I would think so, but wanted to double check with you. I have already opened a pull request to semantic_logger to do this, but haven't received a response. If that does get merged, I'll open a pull request here to do the same. It does look like the builds for Ruby 2.6.0 are failing currently due to this very issue.