Package elki.logging

Class CLISmartHandler


  • public class CLISmartHandler
    extends java.util.logging.Handler
    Handler that handles output to the console with clever formatting.
    Since:
    0.2
    Author:
    Erich Schubert
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.logging.Formatter debugformat
      Formatter for debugging messages
      private java.io.Writer err
      Output stream for error output.
      private java.util.logging.Formatter errformat
      Formatter for error messages
      private java.util.logging.Formatter msgformat
      Formatter for regular messages (informational records)
      private java.io.Writer out
      Output stream for non-critical output.
      private ProgressTracker ptrack
      Tracker for progress messages
    • Constructor Summary

      Constructors 
      Constructor Description
      CLISmartHandler()
      Default constructor using System.out and System.err
      CLISmartHandler​(java.io.OutputStream out, java.io.OutputStream err)
      Constructor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Close output streams.
      void flush()
      Flush output streams
      void publish​(java.util.logging.LogRecord record)
      Publish a log record.
      • 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
    • Field Detail

      • out

        private java.io.Writer out
        Output stream for non-critical output.
      • err

        private java.io.Writer err
        Output stream for error output.
      • msgformat

        private java.util.logging.Formatter msgformat
        Formatter for regular messages (informational records)
      • debugformat

        private java.util.logging.Formatter debugformat
        Formatter for debugging messages
      • errformat

        private java.util.logging.Formatter errformat
        Formatter for error messages
    • Constructor Detail

      • CLISmartHandler

        public CLISmartHandler​(java.io.OutputStream out,
                               java.io.OutputStream err)
        Constructor
        Parameters:
        out - Regular output stream
        err - Error output stream
      • CLISmartHandler

        public CLISmartHandler()
        Default constructor using System.out and System.err
    • Method Detail

      • close

        public void close()
                   throws java.lang.SecurityException
        Close output streams.
        Specified by:
        close in class java.util.logging.Handler
        Throws:
        java.lang.SecurityException
      • flush

        public void flush()
        Flush output streams
        Specified by:
        flush in class java.util.logging.Handler
      • publish

        public void publish​(java.util.logging.LogRecord record)
        Publish a log record.
        Specified by:
        publish in class java.util.logging.Handler