redis/redis-rb — pull request #301 by ayrton (2012-12-03 18:47:21+00:00)
Title: Adds a method to silence logging.

I often find myself adding a method like this to silence Redis logs for operations with 10s of thousands records. (And I didn't see any existing methods that do this)

This prevents seeing a log screen that keeps on piling logs, also when using rails (& webrick) this would prevent blocking incoming requests.

Any remarks, I'll be happy to edit this commit to suit your needs? Should I also add any tests?

Usage:

~~~ ruby
$redis = Redis.new(db: 0, logger: Rails.logger)

$redis.silence do
$redis.sadd('test', 1)
end
~~~