Interface LogEntryFilter

All Superinterfaces:
Predicate<LogEntry>
All Known Implementing Classes:
DefaultLogEntryFilter
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface LogEntryFilter extends Predicate<LogEntry>
The LogEntryFilter interface represents a filter used to determine if a LogEntry should be included or excluded.

The LogEntryFilter interface is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

Implementations of this interface are expected to override the test(LogEntry) method, which takes a LogEntry parameter and returns true if the entry should be included , or false if it should be excluded.

Example usage:

 
 LogEntryFilter filter = entry -> entry.level().ordinal() >= LogLevel.INFO.ordinal();
 boolean shouldInclude = filter.test(logEntry);
 
 
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final LogEntryFilter
    A LogEntryFilter that allows all log entries to pass through.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns a LogEntryFilter that allows all log entries to pass through.
    boolean
    test(LogEntry logEntry)
    Test if a LogEntry should be processed.

    Methods inherited from interface java.util.function.Predicate

    and, negate, or
  • Field Details

    • ALL_PASS_FILTER

      static final LogEntryFilter ALL_PASS_FILTER
      A LogEntryFilter that allows all log entries to pass through.

      This filter implementation always returns true, indicating that all log entries should be included and none filtered out.

  • Method Details

    • test

      boolean test(LogEntry logEntry)
      Test if a LogEntry should be processed.
      Specified by:
      test in interface Predicate<LogEntry>
      Parameters:
      logEntry - the input argument
      Returns:
      true, if the logEntry should be processed, false if it should be filtered out
    • allPass

      static LogEntryFilter allPass()
      Returns a LogEntryFilter that allows all log entries to pass through.
      Returns:
      a LogEntryFilter that allows all log entries to pass through