You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: logging_context_session.rb
    path of file: ./repos/foreman/lib/foreman/middleware
    
    the code of the file until where you have to start completion: require 'securerandom'

module Foreman
  module Middleware
    class LoggingContextSession
      def initialize(app)
        @app = app
      end

   
    
      def call(env)
        session = env['rack.session']

        if env["rack.session"].id.present?
          # use random token to prevent hijack.
          session['logging_token'] ||= SecureRandom.uuid
          ::Logging.mdc['session'] = session['logging_token']
        else
          # or store request token instead of session
          ::Logging.mdc['session'] = env['action_dispatch.request_id']
        end