Sha256: 88e744b2acaa926cc83cf370273daa9213ca68e19da4c6d26a10b3a601962a0f

Contents?: true

Size: 1.39 KB

Versions: 23

Compression:

Stored size: 1.39 KB

Contents

require 'honeybadger'
require 'honeybadger/rails/controller_methods'
require 'honeybadger/rails/action_controller_catcher'

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

      rails_logger = if defined?(::Rails.logger)
                       ::Rails.logger
                     elsif defined?(RAILS_DEFAULT_LOGGER)
                       RAILS_DEFAULT_LOGGER
                     end

      if defined?(::Rails.configuration) && ::Rails.configuration.respond_to?(:middleware)
        ::Rails.configuration.middleware.insert_after 'ActionController::Failsafe',
                                                      Honeybadger::Rack
      end

      Honeybadger.configure(true) do |config|
        config.logger           = rails_logger
        config.environment_name = defined?(::Rails.env) && ::Rails.env || defined?(RAILS_ENV) && RAILS_ENV
        config.project_root     = defined?(::Rails.root) && ::Rails.root || defined?(RAILS_ROOT) && RAILS_ROOT
        config.framework        = defined?(::Rails.version) && "Rails: #{::Rails.version}" || defined?(::Rails::VERSION::STRING) && "Rails: #{::Rails::VERSION::STRING}"
      end
    end
  end
end

Honeybadger::Rails.initialize

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
honeybadger-1.9.5 lib/honeybadger/rails.rb
honeybadger-1.9.4 lib/honeybadger/rails.rb
honeybadger-1.9.3 lib/honeybadger/rails.rb
honeybadger-1.9.2 lib/honeybadger/rails.rb
honeybadger-1.9.1 lib/honeybadger/rails.rb
honeybadger-1.9.0 lib/honeybadger/rails.rb
honeybadger-1.9.0.beta3 lib/honeybadger/rails.rb
honeybadger-1.9.0.beta2 lib/honeybadger/rails.rb
honeybadger-1.9.0.beta1 lib/honeybadger/rails.rb
honeybadger-1.8.1 lib/honeybadger/rails.rb
honeybadger-1.8.0 lib/honeybadger/rails.rb
honeybadger-1.7.0 lib/honeybadger/rails.rb
honeybadger-1.6.2 lib/honeybadger/rails.rb
honeybadger-1.6.1 lib/honeybadger/rails.rb
honeybadger-1.6.0 lib/honeybadger/rails.rb
honeybadger-1.5.0 lib/honeybadger/rails.rb
honeybadger-1.4.0 lib/honeybadger/rails.rb
honeybadger-1.3.1 lib/honeybadger/rails.rb
honeybadger-1.3.0 lib/honeybadger/rails.rb
honeybadger-1.2.1 lib/honeybadger/rails.rb