Sha256: 69c744fe2440c008fec255bf19b5c574d3fc374d326a18767107f25ea641fab2

Contents?: true

Size: 691 Bytes

Versions: 2

Compression:

Stored size: 691 Bytes

Contents

# frozen_string_literal: true
module Europeana
  module Logging
    module LogSessionId
      extend ActiveSupport::Concern

      ##
      # Overrides `#logger` in controller to first set session via
      # `Europeana::Logging::SessionLogging#session=`
      def logger(*args)
        super.session_id = session_id_from_session unless @_request.nil?
        super(*args)
      end

      ##
      # Lograge payload
      def append_info_to_payload(payload)
        super
        payload[:session_id] = session_id_from_session unless session_id_from_session.blank?
      end

      def session_id_from_session
        session.respond_to?(:id) ? session.id : nil
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
europeana-logging-0.2.5 app/controllers/concerns/europeana/logging/log_session_id.rb
europeana-logging-0.2.4 app/controllers/concerns/europeana/logging/log_session_id.rb