<commit_before>module BetterErrors
  # @private
  class Railtie < Rails::Railtie
    initializer "better_errors.configure_rails_initialization" do
      unless Rails.env.production?
        insert_middleware
        BetterErrors.logger = Rails.logger
        BetterErrors.application_root = Rails.root.to_s
      end
    end

    def insert_middleware
      if defined? ActionDispatch::DebugExceptions
        Rails.application.middleware.insert_after ActionDispatch::DebugExceptions, BetterErrors::Middleware
      else
        Rails.application.middleware.use BetterErrors::Middleware
      end
    end
  end
end<commit_msg>take config.consider_all_requests_local into consideration (fixes #118)<commit_after>module BetterErrors
  # @private
  class Railtie < Rails::Railtie
    initializer "better_errors.configure_rails_initialization" do
      if use_better_errors?
        insert_middleware
        BetterErrors.logger = Rails.logger
        BetterErrors.application_root = Rails.root.to_s
      end
    end

    def insert_middleware
      if defined? ActionDispatch::DebugExceptions
        Rails.application.middleware.insert_after ActionDispatch::DebugExceptions, BetterErrors::Middleware
      else
        Rails.application.middleware.use BetterErrors::Middleware
      end
    end

    def use_better_errors?
      !Rails.env.production? and Rails.application.config.consider_all_requests_local
    end
  end
end
{'fraction_non_alphanumeric': 0.05894736842105263, 'fraction_numerical': 0.002105263157894737, 'mean_word_length': 3.498422712933754, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6407286', 'n_tokens_mistral': 403, 'n_tokens_neox': 378, 'n_words': 76}