Module de.carne

Class LogRecorder.Session

  • All Implemented Interfaces:
    java.lang.AutoCloseable
    Enclosing class:
    LogRecorder

    public class LogRecorder.Session
    extends java.util.logging.Handler
    implements java.lang.AutoCloseable
    This class represents a running recording session.
    See Also:
    LogRecorder.start(boolean), close()
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      LogRecorder.Session excludeThread​(java.util.function.Predicate<java.lang.Thread> exclude)
      Add an exclude Predicate to the LogRecorder.Session.
      void flush()  
      java.util.Collection<java.util.logging.LogRecord> getRecords()
      Get the LogRecords that have been recorded by this LogRecorder.Session so far.
      LogRecorder.Session includeThread​(java.util.function.Predicate<java.lang.Thread> include)
      Add an include Predicate to the session.
      void publish​(@Nullable java.util.logging.LogRecord logRecord)  
      • Methods inherited from class java.util.logging.Handler

        getEncoding, getErrorManager, getFilter, getFormatter, getLevel, isLoggable, reportError, setEncoding, setErrorManager, setFilter, setFormatter, setLevel
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • includeThread

        public LogRecorder.Session includeThread​(java.util.function.Predicate<java.lang.Thread> include)
        Add an include Predicate to the session.

        To be recorded an issued LogRecord's thread must match at least one of the include Predicates.

        Parameters:
        include - The include Predicate to apply.
        Returns:
        The updated LogRecorder.Session.
      • excludeThread

        public LogRecorder.Session excludeThread​(java.util.function.Predicate<java.lang.Thread> exclude)
        Add an exclude Predicate to the LogRecorder.Session.

        To be recorded an issued LogRecord's thread must not match any of the exclude Predicates.

        Parameters:
        exclude - The exclude Predicate to apply.
        Returns:
        The updated LogRecorder.Session.
      • getRecords

        public java.util.Collection<java.util.logging.LogRecord> getRecords()
        Get the LogRecords that have been recorded by this LogRecorder.Session so far.
        Returns:
        The recorded LogRecords.
      • publish

        public void publish​(@Nullable java.util.logging.LogRecord logRecord)
        Specified by:
        publish in class java.util.logging.Handler
      • flush

        public void flush()
        Specified by:
        flush in class java.util.logging.Handler
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in class java.util.logging.Handler