Sha256: 0be058df30ed7ea04b59460d0d6f606aff5def44aed159a7ecd4eb61fd61bcc8
Contents?: true
Size: 1.04 KB
Versions: 11
Compression:
Stored size: 1.04 KB
Contents
class AllSeeingEye module Integrations module Rails2 def log_request _start_time = DateTime.now yield _end_time = DateTime.now hash = {} begin Timeout::timeout(AllSeeingEye.configuration['timeout']) { AllSeeingEye::Request.fields.each do |field, options| object = options['object'] == 'controller' ? 'self' : options['object'] val = eval("#{object}#{options['method']}") hash[field] = val end hash['created_at'] = _end_time hash['time_spent'] = (_end_time - _start_time).to_f * 1000 AllSeeingEye::Request.create(hash) Rails.logger.info('+++ Request watched by AllSeeingEye') } rescue Timeout::Error Rails.logger.info('+++ Request not watched by AllSeeingEye; it took too long to complete') end end end end end ActionController::Base.send(:include, AllSeeingEye::Integrations::Rails2) ActionController::Base.send(:around_filter, :log_request)
Version data entries
11 entries across 11 versions & 1 rubygems