Class: Logbert::Handlers::RedisQueueHandler

Inherits:
BaseHandler
  • Object
show all
Defined in:
lib/logbert/handlers/redis_handler.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from BaseHandler

#emit, #formatter, #formatter=

Constructor Details

#initialize(redis_connection, key, options = {}) ⇒ RedisQueueHandler

Returns a new instance of RedisQueueHandler.



11
12
13
14
# File 'lib/logbert/handlers/redis_handler.rb', line 11

def initialize(redis_connection, key, options = {})
  @redis = redis_connection
  @key   = key
end

Instance Attribute Details

#keyObject

Returns the value of attribute key.



9
10
11
# File 'lib/logbert/handlers/redis_handler.rb', line 9

def key
  @key
end

#redisObject

Returns the value of attribute redis.



9
10
11
# File 'lib/logbert/handlers/redis_handler.rb', line 9

def redis
  @redis
end

Instance Method Details

#publish(message) ⇒ Object



16
17
18
# File 'lib/logbert/handlers/redis_handler.rb', line 16

def publish(message)
  redis.lpush(@key, message.to_json)
end