Class: Logtail::Integrations::Rack::SessionContext
- Inherits:
-
Middleware
- Object
- Middleware
- Logtail::Integrations::Rack::SessionContext
- Defined in:
- lib/logtail-rack/session_context.rb
Overview
A Rack middleware that is responsible for adding the Session context Contexts::Session.
Instance Method Summary collapse
Methods inherited from Middleware
enabled=, enabled?, #initialize
Constructor Details
This class inherits a constructor from Logtail::Integrations::Rack::Middleware
Instance Method Details
#call(env) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/logtail-rack/session_context.rb', line 11 def call(env) id = get_session_id(env) if id context = Contexts::Session.new(id: id) CurrentContext.with(context) do @app.call(env) end else @app.call(env) end end |