Class: Trifle::Logger::Middleware::Rack
- Inherits:
-
Object
- Object
- Trifle::Logger::Middleware::Rack
- Defined in:
- lib/trifle/logger/middleware/rack.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ Rack
constructor
A new instance of Rack.
Constructor Details
#initialize(app) ⇒ Rack
Returns a new instance of Rack.
7 8 9 |
# File 'lib/trifle/logger/middleware/rack.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 |
# File 'lib/trifle/logger/middleware/rack.rb', line 11 def call(env) # TODO: set up key # Trifle::Logger.tracer = Trifle::Logger.default.tracer_class.new @status, @headers, @response = @app.call(env) rescue => e # rubocop:disable Style/RescueStandardError Trifle::Logger.tracer&.trace("Exception: #{e}", state: :error) Trifle::Logger.tracer&.fail! raise e ensure Trifle::Logger.tracer&.wrapup [@status, @headers, @response] end |