class Lumberjack::Rack::RequestId
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.
Constants
- REQUEST_ID
Public Class Methods
new(app, abbreviated = false)
click to toggle source
# File lib/lumberjack/rack/request_id.rb, line 9 def initialize(app, abbreviated = false) @app = app @abbreviated = abbreviated end
Public Instance Methods
call(env)
click to toggle source
# File lib/lumberjack/rack/request_id.rb, line 14 def call(env) request_id = env[REQUEST_ID] if request_id && @abbreviated request_id = request_id.split('-'.freeze, 2).first end Lumberjack.unit_of_work(request_id) do @app.call(env) end end