java.lang.Object
net.i2p.router.web.FormHandler
net.i2p.router.web.helpers.EventLogHelper

public class EventLogHelperextends FormHandler
Helper for router event log display and filtering. Renders system events including startup, crashes, network changes, and configuration updates. Provides filtering by event type and time range. Supports /events.jsp page in router console.
  • Field Details

    • EVENT_SPACE

      private static final Pattern EVENT_SPACE
      Matches the text after an event name.
    • EVENT_DIGIT

      private static final Pattern EVENT_DIGIT
      Matches a single digit.
    • _from

      private long _from
      Start time of the events shown.
    • _age

      private long _age
      Age of the events shown.
    • _event

      private String _event
      The event type filtered for.
    • _xevents

      private final Map<String,String> _xevents
      The EventLog names mapped to translated display strings.
    • ALL

      private static final String ALL
      Filter value selecting every event.
      See Also:
    • _events

      private static final String[] _events
      The event names offered in the form.
    • DAY

      private static final long DAY
      One day, in seconds.
      See Also:
    • _times

      private static final long[] _times
      The age options offered in the form, in seconds.
  • Constructor Details

    • EventLogHelper

      public EventLogHelper()
      Prepares the helper with an empty, pre-sized event translation map.
  • Method Details

    • processForm

      protected void processForm()
      Does nothing; the event log page submits no form.
      Specified by:
      processForm in class FormHandler
    • setContextId

      public void setContextId(String contextId)
      Description copied from class: FormHandler
      Configure this bean to query a particular router context.
      Overrides:
      setContextId in class FormHandler
      Parameters:
      contextId - beginning few characters of the routerHash, or null to pick the first one we come across.
    • setFrom

      public void setFrom(String s)
      Set the from.
      Parameters:
      s - the age of the events to list, in seconds; anything unparsable or zero shows all
    • setType

      public void setType(String s)
      Set the type.
      Parameters:
      s - the event category to list, or the all-categories value to show every type
    • getForm

      public String getForm()
      Get the form.
      Returns:
      always the empty string, as required by the JSP getter convention; the markup is written to the response writer
    • writeOption

      private void writeOption(String key, String val) throws IOException
      Writes one option of the filter form.
      Parameters:
      key - the option value
      val - the option label
      Throws:
      IOException - if the writing fails
    • writeOption

      private void writeOption(long age) throws IOException
      Write one age filter option.
      Parameters:
      age - lookback window in seconds; 0 renders as "All events"
      Throws:
      IOException - if the output writer fails
    • getEvents

      public String getEvents()
      Get the events.
      Returns:
      the filtered events rendered as HTML