logAccess(connection, request, size, extra = null) {
    if (this.config.logs.accessLogFormat === "logstash") {
      // custom kuzzle logs to be exported to logstash
      this.logger.info({
        connection,
        error: request.error,
        extra,
        request: request.input,
        status: request.status,
      });
      return;
    }

    // user init: prioritize the already decoded and verified token stored in
    // the request
    // If not available, then that may mean that we didn't verify the user yet,
    // so we have to decode any provided token
    let user = null;

    if (request.context.token !== null) {
      user =
        request.context.token.userId === this.anonymousUserId
          ? "(anonymous)"
          : request.context.token.userId;
    }

    // = apache combined
    const protocol = connection.protocol.toUpperCase();
    let url;
    let verb = "DO";

    if (connection.protocol.indexOf("HTTP/") === 0) {
      verb = extra.method;
      url = extra.url;
    }
    // for other protocols than http, we rebuild a pseudo url
    else {
      url = `/${request.input.controller}/${request.input.action}`;

      if (request.input.args.index) {
        url += `/${request.input.args.index}`;
      }

      if (request.input.args.collection) {
        url += `/${request.input.args.collection}`;
      }

      if (request.input.args._id) {
        url += `/${request.input.args._id}`;
      }

      let queryString = "";

      for (const k of Object.keys(request.input.args)) {
        if (k === "_id" || k === "index" || k === "collection") {
          continue;
        }

        const val = request.input.args[k];

        if (queryString.length > 0) {
          queryString += "&";
        }

        queryString += `${k}=${
          typeof val === "object" ? JSON.stringify(val) : val
        }`;
      }

      if (queryString.length > 0) {
        url += `?${queryString}`;
      }
    }

    if (user === null) {
      user = "(unknown)";
    }

    const ip = this.getIP(connection);
    const when = moment().format("DD/MMM/YYYY:HH:mm:ss ZZ");
    const status = request.status || "-";
    const referer = connection.headers.referer
      ? `"${connection.headers.referer}"`
      : "-";
    const agent = connection.headers["user-agent"]
      ? `"${connection.headers["user-agent"]}"`
      : "-";

    this.logger.info(
      `${ip} - ${user} [${when}] "${verb} ${url} ${protocol}" ${status} ${size} ${referer} ${agent}`,
    );
  }
@param {ClientConnection} connection
@param {Request} request
@param {String} size - response size, in bytes
@param {Object} [extra]