Sha256: 2faaf9eb544f4c6c40c5192f24dc96503bf368a67861be9b05bea4ec55eb3026

Contents?: true

Size: 677 Bytes

Versions: 1

Compression:

Stored size: 677 Bytes

Contents

module Rack::ActionLogger
  class Context

    def initialize(app)
      @app = app
    end

    def call(env)
      Emitter.new.emit do
        status_code, headers, body = @app.call(env)
        capture_rack_log(env, status_code, headers, body)
        [status_code, headers, body]
      end
    end

    def capture_rack_log(env, status_code, headers, body)
      rack_metrics = Rack::ActionLogger.configuration.rack_metrics.new(env, status_code, headers, body)
      Rack::ActionLogger::Container.set_request_log(rack_metrics.metrics, rack_metrics.tag_suffix)
      Rack::ActionLogger::Container.merge_attributes({ request_id: rack_metrics.request_id })
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rack-action_logger-0.1.2 lib/rack/action_logger/context.rb