# File lib/openshift/user_action_log.rb, line 15 def self.action(action, success=true, description=nil, args={}, detailed_description=nil) return unless logger result = success ? "SUCCESS" : "FAILURE" description = (description || "").strip detailed_description = (detailed_description || "").strip time_obj = Time.new date = time_obj.strftime("%Y-%m-%d") time = time_obj.strftime("%H:%M:%S") message = "#{result} DATE=#{date} TIME=#{time} ACTION=#{action} REQ_ID=#{Thread.current[:user_action_log_uuid]}" auth = " USER_ID=#{Thread.current[:user_action_log_user_id].to_s} LOGIN=#{Thread.current[:user_action_log_identity_id].to_s}" extra = args.map{|k,v| " #{k}=#{v}"}.join # We are not logging the detailed multi-line logs in the user action logger logger.info("#{message}#{auth}#{extra} #{description}") unless Rails.env.production? # Using a block prevents the message in the block from being executed # if the log_level is lower than the one set for the logger Rails.logger.add(Logger::DEBUG){ " #{result} ACTION=#{action}#{auth}#{extra} #{description} #{detailed_description}" } end end
# File lib/openshift/user_action_log.rb, line 3 def self.begin_request(request) Thread.current[:user_action_log_uuid] = request ? request.uuid : nil end
Generated with the Darkfish Rdoc Generator 2.