/** * A Log collects and performs computations on LogRecords. This is * an interface because we may implement logs different, e.g. as * a local array, as a Collection, as a remote server or database, etc. */ public interface Log { /** * Stores a LogRecord in the Log if it matches the current * filter (as set by setFilter, below). */ public void add(LogRecord record); /** * Returns all LogRecords whose timestamps are within a window of * time. Note that inclusion is based on the timestamp of the * LogRecord, not the time at which the record was stored in the * Log. * * @param windowMS return all records from the last [windowMS] * milliseconds. */ public LogRecord[] getAll(long windowMS); /** * Sets a regular-expression filter on what events are stored. * * @param pattern is a regular expression to match against; if the * event portion of a LogRecord passed to add, above, matches this * expression, then the LogRecord is retained, and is otherwise * discarded. */ public void setFilter(String pattern); }