Sha256: d2a2e3c6d565465c42f3ea94b862e07a194252a9321b65c29419322201f72437
Contents?: true
Size: 663 Bytes
Versions: 3
Compression:
Stored size: 663 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rack-ougai-0.2.1 | lib/rack/ougai/attach_requestid.rb |
rack-ougai-0.2.0 | lib/rack/ougai/attach_requestid.rb |
rack-ougai-0.1.0 | lib/rack/ougai/attach_requestid.rb |