module RedisStreamLogger

Constants

VERSION

Public Class Methods

setup(app) click to toggle source

I based this heavily on the LogstashLogger implementation but we'll only accept our own config class here

# File lib/redis_stream_logger/railtie.rb, line 6
def self.setup(app)
  return unless app.config.redis_stream_logger.present?
  conf = app.config.redis_stream_logger
  raise ArgumentError, 'unexpected config class' unless conf.is_a?(Config)

  logdev = RedisStreamLogger::LogDevice.new do |_c|
    conf
  end

  logger = Logger.new(logdev)
  logger.level = app.config.log_level
  app.config.logger = logger
end