Sha256: 72cadf17077e1a225e78b4377cabe5a157aa3765651c00bbfdfa8eee2ef11c19

Contents?: true

Size: 1.35 KB

Versions: 24

Compression:

Stored size: 1.35 KB

Contents

# Rails 2.x hooks
# For Rails 3+ hooks, see railtie.rb

require "bugsnag"
require "bugsnag/rails/controller_methods"
require "bugsnag/rails/action_controller_rescue"
require "bugsnag/middleware/rails2_request"
require "bugsnag/middleware/callbacks"

module Bugsnag
  module Rails
    def self.initialize
      if defined?(ActionController::Base)
        ActionController::Base.send(:include, Bugsnag::Rails::ActionControllerRescue)
        ActionController::Base.send(:include, Bugsnag::Rails::ControllerMethods)
      end

      # Try to find where to log to
      rails_logger = nil
      if defined?(::Rails.logger)
        rails_logger = ::Rails.logger
      elsif defined?(RAILS_DEFAULT_LOGGER)
        rails_logger = RAILS_DEFAULT_LOGGER
      end

      Bugsnag.configure do |config|
        config.logger ||= rails_logger
        config.release_stage = RAILS_ENV if defined?(RAILS_ENV)
        config.project_root = RAILS_ROOT if defined?(RAILS_ROOT)

        config.middleware.use Bugsnag::Middleware::Rails2Request
      end

      # Auto-load configuration settings from config/bugsnag.yml if it exists
      config_file = File.join(RAILS_ROOT, "config", "bugsnag.yml")
      config = YAML.load_file(config_file) if File.exists?(config_file)
      Bugsnag.configure(config[RAILS_ENV] ? config[RAILS_ENV] : config) if config
    end
  end
end

Bugsnag::Rails.initialize

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
bugsnag-1.3.8 lib/bugsnag/rails.rb
bugsnag-1.3.7 lib/bugsnag/rails.rb
bugsnag-1.3.6 lib/bugsnag/rails.rb
bugsnag-1.3.5 lib/bugsnag/rails.rb
bugsnag-1.3.4 lib/bugsnag/rails.rb
bugsnag-1.3.3 lib/bugsnag/rails.rb
bugsnag-1.3.2 lib/bugsnag/rails.rb
bugsnag-1.3.1 lib/bugsnag/rails.rb
bugsnag-1.3.0 lib/bugsnag/rails.rb
bugsnag-1.2.18 lib/bugsnag/rails.rb
bugsnag-1.2.17 lib/bugsnag/rails.rb
bugsnag-1.2.16 lib/bugsnag/rails.rb
bugsnag-1.2.15 lib/bugsnag/rails.rb
bugsnag-1.2.14 lib/bugsnag/rails.rb
bugsnag-1.2.13 lib/bugsnag/rails.rb
bugsnag-1.2.12 lib/bugsnag/rails.rb
bugsnag-1.2.11 lib/bugsnag/rails.rb
bugsnag-1.2.10 lib/bugsnag/rails.rb
bugsnag-1.2.9 lib/bugsnag/rails.rb
bugsnag-1.2.8 lib/bugsnag/rails.rb