Sha256: 22718a04c39052911be33f0c6432e54b012873b632204f341f79bd01a1e93258
Contents?: true
Size: 661 Bytes
Versions: 1
Compression:
Stored size: 661 Bytes
Contents
require 'ougai' module Rack module Ougai class AttachRequestID REQUEST_ID_KEY = 'HTTP_X_REQUEST_ID' def initialize(app, opts = {}) @app = app @storage = opts[:storage] || proc { Thread.current } end def call(env) parent = env[Rack::RACK_LOGGER] request_id = env[REQUEST_ID_KEY] if request_id.nil? parent.warn "No request ID in storage (is Rack::RequestID in your middleware stack?)." end env[Rack::RACK_LOGGER] = parent.child(request_id: request_id) ret = @app.call(env) env[Rack::RACK_LOGGER] = parent ret end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rack-ougai-0.3.0 | lib/rack/ougai/attach_request_id.rb |