Class: Timber::Integrations::Rails::SessionContext

Inherits:
Timber::Integrations::Rack::Middleware
  • Object
show all
Defined in:
lib/timber-rails/session_context.rb

Overview

A Rack middleware that is responsible for adding the Session context Contexts::Session.

Instance Method Summary collapse

Instance Method Details

#call(env) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/timber-rails/session_context.rb', line 10

def call(env)
  id = get_session_id(env)
  if id
    context = Contexts::Session.new(id: id)
    CurrentContext.add(context.to_hash)
  end
  @app.call(env)
end