Skip to content

Silence Hashie::Mash logger on Hashie 3.5.0+ - #874

Merged
tmilewski merged 1 commit into
omniauth:masterfrom
michaelherold:silence-mash-logger
Feb 6, 2017
Merged

tmilewski merged 1 commit into
omniauth:masterfrom
michaelherold:silence-mash-logger

Conversation

@michaelherold

@michaelherold michaelherold commented Feb 3, 2017 •

Copy link
Copy Markdown
Contributor

We introduced a new logger for Mash due to the huge number of issues
that we get where people try to set keys on their Mash. This change
silences the info messages that get logged when a Mash has a conflict
with a method name.

I had to do this in a kind of hacky way. Since OmniAuth supports Hashie
versions >= 1.2, < 4, I can't just hook into the method that we'll be
adding in 3.5.2. As such, I apply an override for the logging method if
the disable method isn't present.

I'm also only overriding the method in versions that have the logging
capability.

If anyone has a better suggestion on how to handle this, I'm open to
suggestions! I'm also open to changing the KeyStore name. I went
with that because OmniAuth::Mash wouldn't communicate much if you
aren't familiar with Hashie.

Fixes #872

@michaelherold michaelherold mentioned this pull request Feb 3, 2017
@michaelherold
michaelherold force-pushed the silence-mash-logger branch 2 times, most recently from dfb8d7a to f819d09 Compare February 3, 2017 23:08
@michaelherold

Copy link
Copy Markdown
Contributor Author

The test around this are ... convoluted ... because of the requirement for coverage not dropping.

@michaelherold

Copy link
Copy Markdown
Contributor Author

The failure on 1.8.7 doesn't seem to have anything to do with this change.

@tmilewski

Copy link
Copy Markdown
Member

Hey @michaelherold, would you mind either rebasing on master or allowing edits from maintainers? Thanks!

We introduced a new logger for Mash due to the huge number of issues
that we get where people try to set keys on their Mash. This change
silences the info messages that get logged when a Mash has a conflict
with a method name.

I had to do this in a kind of hacky way. Since OmniAuth supports Hashie
versions `>= 1.2, < 4`, I can't just hook into the method that we'll be
adding in 3.5.2. As such, I apply an override for the logging method if
the disable method isn't present.

I'm also only overriding the method in versions that have the logging
capability.
@michaelherold

Copy link
Copy Markdown
Contributor Author

There you go @tmilewski - I rebased it. I don't see any setting that should be preventing you from editing.

Please let me know if there's anything else I can do!

@tmilewski
tmilewski merged commit 0edc7ec into omniauth:master Feb 6, 2017
@tmilewski

Copy link
Copy Markdown
Member

Perfect, thank you!

@michaelherold
michaelherold deleted the silence-mash-logger branch February 6, 2017 15:07
@michaelherold

Copy link
Copy Markdown
Contributor Author

I just released Hashie v3.5.2 which has the disable_warnings feature for the Mash logger.

@JulienItard

Copy link
Copy Markdown

@michaelherold
Hi, how can I use this new disable_warnings on rails ? I'm on hashie 3.5.5.
I tryed Hashie.logger = Logger.new(nil) in initializer but it doesn't work.

Thanks 👍

oliverguenther added a commit to opf/openproject that referenced this pull request Jun 13, 2017
Fixes hashie warnings of the kind

```
You are setting a key that conflicts with a built-in method Foo#bar.
```

Warnings have been silenced in:
omniauth/omniauth#874

Since our PR (omniauth/omniauth#837) has not
been answered, we maintain our own fork.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants