Sha256: 07c0c2241d8d57ec3c5f81ce67358b1967051a14626ac04aa1fd7b910138eab3
Contents?: true
Size: 729 Bytes
Versions: 10
Compression:
Stored size: 729 Bytes
Contents
# frozen_string_literals: true module Lumberjack module Rack # Support for using the Rails ActionDispatch request id in the log. # The format is expected to be a random UUID and only the first chunk is used for terseness # if the abbreviated argument is true. class RequestId REQUEST_ID = "action_dispatch.request_id" def initialize(app, abbreviated = false) @app = app @abbreviated = abbreviated end def call(env) request_id = env[REQUEST_ID] if request_id && @abbreviated request_id = request_id.split('-', 2).first end Lumberjack.unit_of_work(request_id) do @app.call(env) end end end end end
Version data entries
10 entries across 10 versions & 1 rubygems