All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.hubspot.chrome.devtools.client.core.log.Log Maven / Gradle / Ivy

package com.hubspot.chrome.devtools.client.core.log;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.hubspot.chrome.devtools.base.ChromeRequest;
import com.hubspot.chrome.devtools.base.ChromeSessionCore;
import java.util.List;

/**
 * Provides access to log entries.
 */
public final class Log {
  ChromeSessionCore chromeSession;

  ObjectMapper objectMapper;

  public Log(ChromeSessionCore chromeSession, ObjectMapper objectMapper) {
    this.chromeSession = chromeSession;
    this.objectMapper = objectMapper;
  }

  /**
   * Clears the log.
   */
  public void clear() {
    ChromeRequest chromeRequest = new ChromeRequest("Log.clear");
    chromeSession.send(chromeRequest);
  }

  /**
   * Clears the log.
   */
  public void clearAsync() {
    ChromeRequest chromeRequest = new ChromeRequest("Log.clear");
    chromeSession.sendAsync(chromeRequest);
  }

  /**
   * Disables log domain, prevents further log entries from being reported to the client.
   */
  public void disable() {
    ChromeRequest chromeRequest = new ChromeRequest("Log.disable");
    chromeSession.send(chromeRequest);
  }

  /**
   * Disables log domain, prevents further log entries from being reported to the client.
   */
  public void disableAsync() {
    ChromeRequest chromeRequest = new ChromeRequest("Log.disable");
    chromeSession.sendAsync(chromeRequest);
  }

  /**
   * Enables log domain, sends the entries collected so far to the client by means of the
   * `entryAdded` notification.
   */
  public void enable() {
    ChromeRequest chromeRequest = new ChromeRequest("Log.enable");
    chromeSession.send(chromeRequest);
  }

  /**
   * Enables log domain, sends the entries collected so far to the client by means of the
   * `entryAdded` notification.
   */
  public void enableAsync() {
    ChromeRequest chromeRequest = new ChromeRequest("Log.enable");
    chromeSession.sendAsync(chromeRequest);
  }

  /**
   * start violation reporting.
   *
   * @param config  Configuration for violations.
   */
  public void startViolationsReport(List config) {
    ChromeRequest chromeRequest = new ChromeRequest("Log.startViolationsReport");
    chromeRequest
        .putParams("config", config);
    chromeSession.send(chromeRequest);
  }

  /**
   * start violation reporting.
   *
   * @param config  Configuration for violations.
   */
  public void startViolationsReportAsync(List config) {
    ChromeRequest chromeRequest = new ChromeRequest("Log.startViolationsReport");
    chromeRequest
        .putParams("config", config);
    chromeSession.sendAsync(chromeRequest);
  }

  /**
   * Stop violation reporting.
   */
  public void stopViolationsReport() {
    ChromeRequest chromeRequest = new ChromeRequest("Log.stopViolationsReport");
    chromeSession.send(chromeRequest);
  }

  /**
   * Stop violation reporting.
   */
  public void stopViolationsReportAsync() {
    ChromeRequest chromeRequest = new ChromeRequest("Log.stopViolationsReport");
    chromeSession.sendAsync(chromeRequest);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy