Class: Rack::RailsLoggr

Inherits:
Object
  • Object
show all
Defined in:
lib/loggr-rb/integration/rack_rails.rb

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ RailsLoggr

Returns a new instance of RailsLoggr.



7
8
9
# File 'lib/loggr-rb/integration/rack_rails.rb', line 7

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/loggr-rb/integration/rack_rails.rb', line 11

def call(env)
  begin
    body = @app.call(env)
  rescue Exception => e
    ::Loggr::Catcher.handle_with_controller(e,env['action_controller.instance'], Rack::Request.new(env))
    raise
  end

  if env['rack.exception']
    ::Loggr::Catcher.handle_with_controller(env['rack.exception'],env['action_controller.instance'], Rack::Request.new(env))
  end

  body
end