Record Class WaitForLogOptions

java.lang.Object
java.lang.Record
codes.grow.packages.skywalking.logging.WaitForLogOptions
Record Components:
timeout - overall wait (default 30 s)
interval - delay between searches (default 1 s)
predicate - extra filter on the found records (default: any record)
search - options of each search (default SearchOptions.defaults())

public record WaitForLogOptions(Duration timeout, Duration interval, Predicate<LogRecord> predicate, SearchOptions search) extends Record
  • Field Details

    • DEFAULT_INTERVAL

      public static final Duration DEFAULT_INTERVAL
      The interval used when none is given. explicitInterval() tells this default apart from an interval the caller chose, so a service can apply its own default (passing this constant itself counts as unset).
  • Constructor Details

    • WaitForLogOptions

      public WaitForLogOptions(Duration timeout, Duration interval, Predicate<LogRecord> predicate, SearchOptions search)
      Fills defaults for null values.
      Parameters:
      timeout - overall wait
      interval - delay between searches
      predicate - record filter
      search - search options
  • Method Details

    • defaults

      public static WaitForLogOptions defaults()
      Defaults: 30 s timeout, 1 s interval, any record.
      Returns:
      defaults
    • of

      public static WaitForLogOptions of(Duration timeout, Duration interval)
      Options with a timeout and interval.
      Parameters:
      timeout - overall wait
      interval - delay between searches
      Returns:
      options
    • withPredicate

      public WaitForLogOptions withPredicate(Predicate<LogRecord> filter)
      Copy with a predicate.
      Parameters:
      filter - record filter
      Returns:
      options
    • explicitInterval

      public Optional<Duration> explicitInterval()
      Returns the interval the caller set, or empty when it was left unset (the record then holds DEFAULT_INTERVAL).
      Returns:
      the explicit interval, if any
    • intervalOr

      public Duration intervalOr(Duration serviceDefault)
      Returns the caller's interval, or serviceDefault when it was left unset.
      Parameters:
      serviceDefault - the service's own default interval
      Returns:
      the interval to use
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • timeout

      public Duration timeout()
      Returns the value of the timeout record component.
      Returns:
      the value of the timeout record component
    • interval

      public Duration interval()
      Returns the value of the interval record component.
      Returns:
      the value of the interval record component
    • predicate

      public Predicate<LogRecord> predicate()
      Returns the value of the predicate record component.
      Returns:
      the value of the predicate record component
    • search

      public SearchOptions search()
      Returns the value of the search record component.
      Returns:
      the value of the search record component