Class: Appsignal::Integrations::Railtie Private

Inherits:
Rails::Railtie
  • Object
show all
Defined in:
lib/appsignal/integrations/railtie.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Class Method Summary collapse

Class Method Details

.initialize_appsignal(app) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/appsignal/integrations/railtie.rb', line 16

def self.initialize_appsignal(app)
  # Load config
  Appsignal.config = Appsignal::Config.new(
    Rails.root,
    Rails.env,
    :name => Appsignal::Utils::RailsHelper.detected_rails_app_name,
    :log_path => Rails.root.join("log")
  )

  # Start logger
  Appsignal.start_logger

  app.middleware.insert_after(
    ActionDispatch::DebugExceptions,
    Appsignal::Rack::RailsInstrumentation
  )

  if Appsignal.config[:enable_frontend_error_catching]
    app.middleware.insert_before(
      Appsignal::Rack::RailsInstrumentation,
      Appsignal::Rack::JSExceptionCatcher
    )
  end

  Appsignal.start
end