Sha256: cf4f8908dab1051eb86fe5f7fda40e8b3642d9776160eef60939917030211c3f

Contents?: true

Size: 915 Bytes

Versions: 8

Compression:

Stored size: 915 Bytes

Contents

require 'airbrake/rails/railtie'

module Airbrake
  # Rails namespace holds all Rails-related functionality.
  module Rails
    def self.logger
      if ENV['RAILS_LOG_TO_STDOUT'].present?
        Logger.new(STDOUT, level: ::Rails.logger.level)
      else
        Logger.new(
          ::Rails.root.join('log', 'airbrake.log'),

          # Rails.logger is not set in some Rake tasks such as
          # 'airbrake:deploy'. In this case we use a sensible fallback.
          level: (::Rails.logger ? ::Rails.logger.level : Logger::ERROR)
        )
      end
    end
  end
end

if defined?(ActionController::Metal)
  require 'airbrake/rails/action_controller'
  module ActionController
    # Adds support for Rails API/Metal for Rails < 5. Rails 5+ uses standard
    # hooks.
    # @see https://github.com/airbrake/airbrake/issues/821
    class Metal
      include Airbrake::Rails::ActionController
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
airbrake-9.5.5 lib/airbrake/rails.rb
airbrake-9.5.4 lib/airbrake/rails.rb
airbrake-9.5.3 lib/airbrake/rails.rb
airbrake-9.5.2 lib/airbrake/rails.rb
airbrake-9.5.1 lib/airbrake/rails.rb
airbrake-9.5.0 lib/airbrake/rails.rb
airbrake-9.4.5 lib/airbrake/rails.rb
airbrake-9.4.4 lib/airbrake/rails.rb