code: private String getAccessLog(String ip, User visitor, Integer userId, String browser,
                                  String url, long elapsedTime) {
          StringBuilder sb = new StringBuilder();
          sb.append(null != ip ? ip : "unknown").append("\t");
  
          if (visitor == null) {
              sb.append("-\t-\t");
          } else {
              if (userId == null) {
                  sb.append("-\t");
              } else {
                  sb.append(
                          visitor.getUserId() == userId ? AccessLogType.PORTAL_USER
                                  : AccessLogType.MANAGER).append("\t");
              }
              sb.append(visitor.getUserId()).append(",").append(visitor.getUserName()).append(",")
                      .append(visitor.getRoles()).append("\t");
          }
  
          sb.append(null != userId ? userId : "-").append("\t");
          sb.append(url).append("\t");
          sb.append(browser).append("\t");
          sb.append(elapsedTime).append("ms");
          return sb.toString();
      }
docs: 记录访问日志
  
  @param ip          访问IP
  @param visitor     访问者
  @param userId      用户id
  @param browser     浏览器
  @param url         访问URL
  @param elapsedTime 请求耗时
  
  @return 记录日志行