Only warn once for each instance a deprecated method is called #42

Merged
merged 5 commits into from Apr 16, 2012

Conversation

Projects
None yet
2 participants
@arsduo

arsduo commented Apr 16, 2012

Right now, MultiJson prints a deprecation warning every time an outdated method is called. Unfortunately, in some cases this results in a flood of output. The preferred solution is obviously to patch the offending gem (I've submitted a pull request for Resque), but it looks like activesupport-3.1.4 itself uses decode, resulting in a flood of warnings whenever we run our test suite.

This pull request adds a deprecate method, which prints out a warning message once for each message/caller pair (e.g. decode called four times from in two places in the code will generate two messages). This should keep logs clean and manageable, but also get the point across.

I've also updated the readme to reflect the new sytax, no point in telling users to do something that'll generate warnings.

All specs pass; I've run the tests for our application against this fork as well, which pass and show the expected less noisy behavior.

Thanks for the great gem!

sferik added a commit that referenced this pull request Apr 16, 2012

Merge pull request #42 from arsduo/master
Only warn once for each instance a deprecated method is called

@sferik sferik merged commit d05c613 into intridea:master Apr 16, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment