Method: Justlogging::Middleware#call

Defined in:
lib/justlogging/middleware.rb

#call(env) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/justlogging/middleware.rb', line 10

def call(env)
  Justlogging::Transaction.create(env['action_dispatch.request_id'], env)
  @app.call(env)
rescue Exception => exception
  unless includes_exception?(exception)
    Justlogging::Transaction.current.add_exception(
      Justlogging::ExceptionNotification.new(env, exception)
    )
  end
  raise exception
ensure
  Justlogging::Transaction.current.complete!
end