Sha256: f3e7baa7371b478fac8cdead902d137e4a0140475b84610d2062569d289c9cc6

Contents?: true

Size: 675 Bytes

Versions: 4

Compression:

Stored size: 675 Bytes

Contents

# frozen_string_literal: true

module Trifle
  module Logger
    module Middleware
      class Rack
        def initialize(app)
          @app = app
        end

        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
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
trifle-logger-0.4.1 lib/trifle/logger/middleware/rack.rb
trifle-logger-0.4.0 lib/trifle/logger/middleware/rack.rb
trifle-logger-0.3.1 lib/trifle/logger/middleware/rack.rb
trifle-logger-0.3.0 lib/trifle/logger/middleware/rack.rb