Class: Lumberjack::Rack::RequestId Deprecated
- Inherits:
-
Object
- Object
- Lumberjack::Rack::RequestId
- Defined in:
- lib/lumberjack/rack/request_id.rb
Overview
Deprecated.
Use tags instead of request id for unit of work. Will be removed in version 2.0.
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.
Constant Summary collapse
- REQUEST_ID =
"action_dispatch.request_id"
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, abbreviated = false) ⇒ RequestId
constructor
A new instance of RequestId.
Constructor Details
#initialize(app, abbreviated = false) ⇒ RequestId
Returns a new instance of RequestId.
13 14 15 16 17 18 |
# File 'lib/lumberjack/rack/request_id.rb', line 13 def initialize(app, abbreviated = false) Lumberjack::Utils.deprecated("Lumberjack::Rack::RequestId", "Lumberjack::Rack::RequestId will be removed in version 2.0") do @app = app @abbreviated = abbreviated end end |
Instance Method Details
#call(env) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/lumberjack/rack/request_id.rb', line 20 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 |