<commit_before>package replicant.spy.tools;

import elemental2.dom.DomGlobal;
import javax.annotation.Nonnull;
import org.realityforge.anodoc.Unsupported;
import replicant.AreaOfInterest;
import replicant.FilterUtil;
import replicant.Subscription;
import replicant.spy.AreaOfInterestCreatedEvent;
import replicant.spy.AreaOfInterestDisposedEvent;
import replicant.spy.AreaOfInterestFilterUpdatedEvent;
import replicant.spy.AreaOfInterestStatusUpdatedEvent;
import replicant.spy.ConnectFailureEvent;
import replicant.spy.ConnectedEvent;
import replicant.spy.DisconnectedEvent;
import replicant.spy.SubscriptionCreatedEvent;
import replicant.spy.SubscriptionDisposedEvent;
import replicant.spy.SubscriptionOrphanedEvent;

/**
 * A SpyEventHandler that prints spy events to the tools console.
 * The events are colored to make them easy to digest. This class is designed to be easy to sub-class.
 */
@Unsupported( "This class relies on unstable spy API and will likely evolve as the api evolves" )
public class ConsoleSpyEventProcessor
  extends AbstractSpyEventProcessor
{
  @CssRules
  private static final String ENTITY_COLOR = "color: #CF8A3B; font-weight: normal;";
  @CssRules
  private static final String CONNECTOR_COLOR = "color: #F5A402; font-weight: normal;";
  @CssRules
  private static final String SUBSCRIPTION_COLOR = "color: #0FA13B; font-weight: normal;";
  @CssRules
  private static final String AREA_OF_INTEREST_COLOR = "color: #006AEB; font-weight: normal;";
  @CssRules
  private static final String ERROR_COLOR = "color: #A10001; font-weight: normal;";

  /**
   * Create the processor.
   */
  public ConsoleSpyEventProcessor()
  {
    on( AreaOfInterestCreatedEvent.class, this::onAreaOfInterestCreated );
    on( AreaOfInterestFilterUpdatedEvent.class, this::onAreaOfInterestFilterUpdated );
    on( AreaOfInterestStatusUpdatedEvent.class, this::onAreaOfInterestStatusUpdated );
    on( AreaOfInterestDisposedEvent.class, this::onAreaOfInterestDisposed );

    on( SubscriptionCreatedEvent.class, this::onSubscriptionCreated );
    on( SubscriptionDisposedEvent.class, this::onSubscriptionDisposed );
    on( SubscriptionOrphanedEvent.class, this::onSubscriptionOrphaned );

    on( ConnectedEvent.class, this::onConnected );
    on( ConnectFailureEvent.class, this::onConnectFailure );
    on( DisconnectedEvent.class, this::onDisconnected );
  }

  /**
   * Handle the ConnectedEvent.
   *
   * @param e the event.
   */
  private void onConnected( @Nonnull final ConnectedEvent e )
  {
    log( "%cConnector Connected " + e.getSystemType().getSimpleName(), CONNECTOR_COLOR );
  }

  /**
   * Handle the ConnectFailureEvent.
   *
   * @param e the event.
   */
  private void onConnectFailure( @Nonnull final ConnectFailureEvent e )
  {
    log( "%cConnector Connect Failed " + e.getSystemType().getSimpleName() + " Error: " + e.getError(), ERROR_COLOR );
  }

  /**
   * Handle the DisconnectedEvent.
   *
   * @param e the event.
   */
  private void onDisconnected( @Nonnull final DisconnectedEvent e )
  {
    log( "%cConnector Discnnected " + e.getSystemType().getSimpleName(), CONNECTOR_COLOR );
  }
<commit_msg>Spelling<commit_after>package replicant.spy.tools;

import elemental2.dom.DomGlobal;
import javax.annotation.Nonnull;
import org.realityforge.anodoc.Unsupported;
import replicant.AreaOfInterest;
import replicant.FilterUtil;
import replicant.Subscription;
import replicant.spy.AreaOfInterestCreatedEvent;
import replicant.spy.AreaOfInterestDisposedEvent;
import replicant.spy.AreaOfInterestFilterUpdatedEvent;
import replicant.spy.AreaOfInterestStatusUpdatedEvent;
import replicant.spy.ConnectFailureEvent;
import replicant.spy.ConnectedEvent;
import replicant.spy.DisconnectedEvent;
import replicant.spy.SubscriptionCreatedEvent;
import replicant.spy.SubscriptionDisposedEvent;
import replicant.spy.SubscriptionOrphanedEvent;

/**
 * A SpyEventHandler that prints spy events to the tools console.
 * The events are colored to make them easy to digest. This class is designed to be easy to sub-class.
 */
@Unsupported( "This class relies on unstable spy API and will likely evolve as the api evolves" )
public class ConsoleSpyEventProcessor
  extends AbstractSpyEventProcessor
{
  @CssRules
  private static final String ENTITY_COLOR = "color: #CF8A3B; font-weight: normal;";
  @CssRules
  private static final String CONNECTOR_COLOR = "color: #F5A402; font-weight: normal;";
  @CssRules
  private static final String SUBSCRIPTION_COLOR = "color: #0FA13B; font-weight: normal;";
  @CssRules
  private static final String AREA_OF_INTEREST_COLOR = "color: #006AEB; font-weight: normal;";
  @CssRules
  private static final String ERROR_COLOR = "color: #A10001; font-weight: normal;";

  /**
   * Create the processor.
   */
  public ConsoleSpyEventProcessor()
  {
    on( AreaOfInterestCreatedEvent.class, this::onAreaOfInterestCreated );
    on( AreaOfInterestFilterUpdatedEvent.class, this::onAreaOfInterestFilterUpdated );
    on( AreaOfInterestStatusUpdatedEvent.class, this::onAreaOfInterestStatusUpdated );
    on( AreaOfInterestDisposedEvent.class, this::onAreaOfInterestDisposed );

    on( SubscriptionCreatedEvent.class, this::onSubscriptionCreated );
    on( SubscriptionDisposedEvent.class, this::onSubscriptionDisposed );
    on( SubscriptionOrphanedEvent.class, this::onSubscriptionOrphaned );

    on( ConnectedEvent.class, this::onConnected );
    on( ConnectFailureEvent.class, this::onConnectFailure );
    on( DisconnectedEvent.class, this::onDisconnected );
  }

  /**
   * Handle the ConnectedEvent.
   *
   * @param e the event.
   */
  private void onConnected( @Nonnull final ConnectedEvent e )
  {
    log( "%cConnector Connected " + e.getSystemType().getSimpleName(), CONNECTOR_COLOR );
  }

  /**
   * Handle the ConnectFailureEvent.
   *
   * @param e the event.
   */
  private void onConnectFailure( @Nonnull final ConnectFailureEvent e )
  {
    log( "%cConnector Connect Failed " + e.getSystemType().getSimpleName() + " Error: " + e.getError(), ERROR_COLOR );
  }

  /**
   * Handle the DisconnectedEvent.
   *
   * @param e the event.
   */
  private void onDisconnected( @Nonnull final DisconnectedEvent e )
  {
    log( "%cConnector Disconnected " + e.getSystemType().getSimpleName(), CONNECTOR_COLOR );
  }

{'fraction_non_alphanumeric': 0.09643539147040102, 'fraction_numerical': 0.005728835136855506, 'mean_word_length': 4.968660968660969, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '679980', 'n_tokens_mistral': 1956, 'n_tokens_neox': 1877, 'n_words': 458}