You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

26 lines
809 B

module Semantic
class LogSubscriber < ActiveSupport::LogSubscriber
include SemanticLogger::Loggable
# def logger = SemanticLogger['Rails']
SESSION_KEY = 'toto1'.freeze
def initialize
end
def start_processing(event)
request = event.payload[:request]
rack_session = event.payload[:headers]['rack.session']
session_value = rack_session.fetch(SESSION_KEY, 'EMPTY')
format = event.payload[:format]
format = format.to_s.upcase if format.is_a?(Symbol)
format = '*/*' if format.nil?
SemanticLogger.tagged(session_value) do
logger.info("Started #{request.raw_request_method} #{request.filtered_path}")
logger.debug("Processing by #{event.payload[:controller]}##{event.payload[:action]} as #{format}")
end
end
end
end