APISonar


com.facebook.litho.intellij.extensions.EventLogger.log

> com > facebook > litho > intellij > extensions > EventLogger > log
com APIs facebook APIs litho APIs intellij APIs extensions APIs EventLogger APIs log APIs

Example 1
private final EventLogger eventLogger;

  public void log(String event, Map<String, String> metadata) {
    boolean log = false;
    synchronized (this) {
      long currentTimeMillis = System.currentTimeMillis();
      if (currentTimeMillis - lastTimeMillis > timespanMillis) {
        lastTimeMillis = currentTimeMillis;
        log = true;
      }
    }
    if (log) {
      eventLogger.log(event, metadata);
    }
  }
Example 2
private static final EventLogger logger =
      new DebounceEventLogger(60 /*minutes*/ * 60 /*seconds*/ * 1000);

  public ComponentFileListener() {
    this(
        layoutSpecCls -> {
          if (ComponentGenerateUtils.updateLayoutComponent(layoutSpecCls)) {
            logger.log(TAG);
          }
        });
  }
Example 3
private static final EventLogger LOGGER = new DebounceEventLogger(60_000);

  public void annotate(PsiElement element, AnnotationHolder holder) {
    List<SpecModelValidationError> errors =
        Optional.of(element)
            .filter(PsiClass.class::isInstance)
            .map(PsiClass.class::cast)
            .map(ComponentGenerateUtils::createLayoutModel)
            .map(model -> model.validate(RunMode.normal()))
            .orElse(Collections.emptyList());
    if (!errors.isEmpty()) {
      LOGGER.log(EventLogger.EVENT_ANNOTATOR + ".layout_spec");
      errors.forEach(error -> AnnotatorUtils.addError(holder, error));
    }
  }