# File lib/openshift-origin-controller/app/helpers/user_action_logger.rb, line 16
  def log_action(request_id, user_id, login, action, success = true, description = "")
    log_level = success ? Logger::DEBUG : Logger::ERROR
    action_logger = get_action_logger()

    if not action_logger.nil?
      result = success ? "SUCCESS" : "FAILURE"
      time_obj = Time.new
      date = time_obj.strftime("%Y-%m-%d")
      time = time_obj.strftime("%H:%M:%S")
      action_logger.info("#{result} DATE=#{date} TIME=#{time} ACTION=#{action} REQ_ID=#{request_id} USER_ID=#{user_id} LOGIN=#{login} #{description}")
    end
    
    # 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(log_level) {"[REQ_ID=#{request_id}] ACTION=#{action} #{description}"}
  end