Redis equivalent ActiveRecord :: Base.logger = Logger.new (STDOUT)?

What is equivalent to redis ActiveRecord::Base.logger = Logger.new(STDOUT)? I want to see what redis does.

+5
source share
4 answers

Usually I want to set some additional attributes (for example, the name DB Redis). You can pass arguments in an initialize method like this

$redis = Redis.new(db: Rails.config.redis.db, logger: Rails.logger)
+5
source

$ redis.client.logger = Rails.logger

This is better!

+7
source

Nothing. This is easy:

$redis = Redis.new(:host => 'localhost', :port => 6379)
$redis.client.logger = Logger.new(STDOUT)
+1
source

I wrote a call to the pearl of RedisLogger:

https://github.com/hellolucky/redis_logger

+1
source

All Articles