Sha256: a2bd5401b504d777ecf6b3801c09cea8d7c4ac8d14ffb1f71e7fed9cda656c75

Contents?: true

Size: 914 Bytes

Versions: 6

Compression:

Stored size: 914 Bytes

Contents

# frozen_string_literal: true

require 'airbrake/rails/railtie'

module Airbrake
  # Rails namespace holds all Rails-related functionality.
  module Rails
    def self.logger
      # 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)

      if ENV['RAILS_LOG_TO_STDOUT'].present?
        Logger.new($stdout, level: level)
      else
        Logger.new(::Rails.root.join('log', 'airbrake.log'), level: level)
      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

6 entries across 6 versions & 1 rubygems

Version Path
airbrake-13.0.4 lib/airbrake/rails.rb
airbrake-13.0.3 lib/airbrake/rails.rb
airbrake-13.0.2 lib/airbrake/rails.rb
airbrake-13.0.1 lib/airbrake/rails.rb
airbrake-13.0.0 lib/airbrake/rails.rb
airbrake-12.0.0 lib/airbrake/rails.rb