Sha256: ac005fee7c88944f3ced6e2198183f8365472b7e62a65a632249cbe7f0842555
Contents?: true
Size: 646 Bytes
Versions: 5
Compression:
Stored size: 646 Bytes
Contents
# frozen_string_literal: true require 'rack/body_proxy' module Heavylog class Middleware def initialize(app) @app = app @assets_regex = %r(\A/{0,2}#{::Rails.application.config.assets.prefix}) end def call(env) ignore = env['PATH_INFO'] =~ @assets_regex if !ignore request = ActionDispatch::Request.new(env) RequestStore.store[:heavylog_request_id] = request.uuid RequestStore.store[:heavylog_request_start] = Time.now.iso8601 RequestStore.store[:heavylog_request_ip] = request.ip end @app.call(env) ensure Heavylog.finish if !ignore end end end
Version data entries
5 entries across 5 versions & 1 rubygems