def setup_log(type=:memory)
      case type
        when :memory
          @log_content = StringIO.new
          @logger = Logger.new(@log_content)
        else
          unless defined?(@@log_file_base_name)
            @@log_file_base_name = File.normalize_path(File.join(Dir.tmpdir, "#{File.basename(__FILE__, '.rb')}_#{Time.now.strftime("%Y-%m-%d-%H%M%S")}"))
            @@log_file_index = 0
          end
          @@log_file_index += 1
          @log_file_name = "#{@@log_file_base_name}_#{@@log_file_index}.log"
          @log_file = File.open(@log_file_name, 'w')
          @logger = Logger.new(@log_file)
      end

      @logger.level = is_debug? ? Logger::DEBUG : Logger::INFO
      return @logger
    end
def setup_log(type=:memory)
      case type
        when :memory
          @log_content = StringIO.new
          @logger = Logger.new(@log_content)
        else
          unless defined?(@@log_file_base_name)
            @@log_file_base_name = File.normalize_path(File.join(Dir.tmpdir, "#{File.basename(__FILE__, '.rb')}_#{Time.now.strftime("%Y-%m-%d-%H%M%S")}"))
            @@log_file_index = 0
          end
          @@log_file_index += 1
          @log_file_name = "#{@@log_file_base_name}_#{@@log_file_index}.log"
          @log_file = File.open(@log_file_name, 'w')
          @logger = Logger.new(@log_file)
      end

      @logger.level = is_debug? ? Logger::DEBUG : Logger::INFO
      return @logger
    end
Setup log for test.