class Logging::Appenders::Redis

Provides an appender that can append log messages to a Redis list

Attributes

redis[R]

Public Class Methods

new(name, opts = {}) click to toggle source
Calls superclass method
# File lib/logging/appenders/redis.rb, line 20
def initialize(name, opts = {})
  super(name, opts)
  configure_buffering(opts)
  @redis = ::Redis.new(opts[:redis])
end

Public Instance Methods

close(*_args) click to toggle source

Close the Redis appender.

Calls superclass method
# File lib/logging/appenders/redis.rb, line 28
def close(*_args)
  super(false)
end

Private Instance Methods

canonical_write(str) click to toggle source

This method is called by the buffering code when messages need to be sent out as an Redis.

# File lib/logging/appenders/redis.rb, line 37
def canonical_write(str)
  redis.rpush(name, str)
rescue StandardError => err
  handle_internal_error(err)
end
handle_internal_error(err) click to toggle source
# File lib/logging/appenders/redis.rb, line 43
def handle_internal_error(err)
  return err if off?
  self.level = :off
  ::Logging.log_internal { "appender #{name.inspect} has been disabled" }
  ::Logging.log_internal_error(err)
end