Sha256: 13971c647e0e176c5df1244348a33126c202a0f714872b4b33d034f15c8d0a3a
Contents?: true
Size: 729 Bytes
Versions: 15
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
15 entries across 15 versions & 4 rubygems