Class StatusConsoleListener

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, java.util.EventListener, StatusListener

    public class StatusConsoleListener
    extends java.lang.Object
    implements StatusListener
    StatusListener that writes to the Console.
    • Constructor Summary

      Constructors 
      Constructor Description
      StatusConsoleListener​(Level level)
      Creates the StatusConsoleListener using the supplied Level.
      StatusConsoleListener​(Level level, java.io.PrintStream stream)
      Creates the StatusConsoleListener using the supplied Level.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      Level getStatusLevel()
      Return the Log Level for which the Listener should receive events.
      void log​(StatusData data)
      Writes status messages to the console.
      void setFilters​(java.lang.String... filters)
      Adds package name filters to exclude.
      void setLevel​(Level level)
      Sets the level to a new value.
      • Methods inherited from class java.lang.Object

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

      • StatusConsoleListener

        public StatusConsoleListener​(Level level)
        Creates the StatusConsoleListener using the supplied Level.
        Parameters:
        level - The Level of status messages that should appear on the console.
      • StatusConsoleListener

        public StatusConsoleListener​(Level level,
                                     java.io.PrintStream stream)
        Creates the StatusConsoleListener using the supplied Level. Make sure not to use a logger stream of some sort to avoid creating an infinite loop of indirection!
        Parameters:
        level - The Level of status messages that should appear on the console.
        stream - The PrintStream to write to.
        Throws:
        java.lang.IllegalArgumentException - if the PrintStream argument is null.
    • Method Detail

      • setLevel

        public void setLevel​(Level level)
        Sets the level to a new value.
        Parameters:
        level - The new Level.
      • getStatusLevel

        public Level getStatusLevel()
        Return the Log Level for which the Listener should receive events.
        Specified by:
        getStatusLevel in interface StatusListener
        Returns:
        the Log Level.
      • log

        public void log​(StatusData data)
        Writes status messages to the console.
        Specified by:
        log in interface StatusListener
        Parameters:
        data - The StatusData.
      • setFilters

        public void setFilters​(java.lang.String... filters)
        Adds package name filters to exclude.
        Parameters:
        filters - An array of package names to exclude.
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException