public static void checkIndexAndLog(
    @NotNull Class<?> loggingClass,
    int index,
    int size,
    @NotNull String indexDescription,
    Attachment @NotNull ... attachments
  ) {
    if (index < 0 || index >= size) {
      String message = badElementIndex(index, size, indexDescription);
      Logger.getInstance(loggingClass).error(message, new IndexOutOfBoundsException(message), attachments);
    }
  }
public static void checkIndexAndLog(
    @NotNull Class<?> loggingClass,
    int index,
    int size,
    @NotNull String indexDescription,
    Attachment @NotNull ... attachments
  )