Sha256: 6d5de8a262de6097edfdfdcb7f596b78f8496af2bf8353c5023eaf6db49c9a5c

Contents?: true

Size: 531 Bytes

Versions: 1

Compression:

Stored size: 531 Bytes

Contents

require 'rails/railtie'

module LogStashLogger
  def self.setup(app)
    return unless app.config.logstash.present?

    logger_options = app.config.logstash

    logger = LogStashLogger.new(logger_options)

    logger.level = ::Logger.const_get(app.config.log_level.to_s.upcase)

    app.config.logger = logger
  end

  class Railtie < ::Rails::Railtie
    config.logstash = ActiveSupport::OrderedOptions.new

    initializer :logstash_logger, before: :initialize_logger do |app|
      LogStashLogger.setup(app)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
logstash-logger-0.5.0 lib/logstash-logger/railtie.rb