Class Logger

  • All Implemented Interfaces:
    CleanUpHandler

    public class Logger
    extends Object
    implements CleanUpHandler
    Simple logger class.
    Author:
    FracPete (fracpete at waikato dot ac dot nz)
    • Field Detail

      • m_Name

        protected String m_Name
        the name of the logger.
      • m_Handlers

        protected Set<Handler> m_Handlers
        the handlers.
      • m_Level

        protected Level m_Level
        the level.
    • Constructor Detail

      • Logger

        public Logger​(String name)
        Initializes the logger with the specified name.
        Parameters:
        name - the name
    • Method Detail

      • getName

        public String getName()
        Returns the name of the logger.
        Returns:
        the name
      • addHandler

        public void addHandler​(Handler h)
        Adds the handler.
        Parameters:
        h - the handler
      • removeHandler

        public void removeHandler​(Handler h)
        Removes the handler.
        Parameters:
        h - the handler
      • getHandlers

        public Handler[] getHandlers()
        Returns all current handlers.
        Returns:
        the handlers
      • setLevel

        public void setLevel​(Level value)
        Sets the logging level.
        Parameters:
        value - the level
      • getLevel

        public Level getLevel()
        Returns the logging level.
        Returns:
        the level
      • setUseParentHandlers

        public void setUseParentHandlers​(boolean value)
        Ignored.
        Parameters:
        value - ignored
      • getUseParentHandlers

        public boolean getUseParentHandlers()
        Always false.
        Returns:
        false
      • log

        public void log​(LogRecord record)
        Logs the given record.
        Parameters:
        record - the record
      • severe

        public void severe​(String msg)
        Logs a Level.SEVERE message.
        Parameters:
        msg - the message to log
      • warning

        public void warning​(String msg)
        Logs a Level.WARNING message.
        Parameters:
        msg - the message to log
      • config

        public void config​(String msg)
        Logs a Level.CONFIG message.
        Parameters:
        msg - the message to log
      • info

        public void info​(String msg)
        Logs a Level.INFO message.
        Parameters:
        msg - the message to log
      • fine

        public void fine​(String msg)
        Logs a Level.FINE message.
        Parameters:
        msg - the message to log
      • finer

        public void finer​(String msg)
        Logs a Level.FINER message.
        Parameters:
        msg - the message to log
      • finest

        public void finest​(String msg)
        Logs a Level.FINEST message.
        Parameters:
        msg - the message to log
      • log

        public void log​(Level level,
                        String msg)
        Logs the message with the specified level.
        Parameters:
        level - the level of the message
        msg - the message to log
      • log

        public void log​(Level level,
                        String msg,
                        Throwable t)
        Logs the message with the specified level.
        Parameters:
        level - the level of the message
        msg - the message to log
        t - the exception to log
      • log

        public void log​(Level level,
                        String msg,
                        Object param)
        Logs the message with the specified level.
        Parameters:
        level - the level of the message
        msg - the message to log
        param - the parameter to log
      • log

        public void log​(Level level,
                        String msg,
                        Object[] params)
        Logs the message with the specified level.
        Parameters:
        level - the level of the message
        msg - the message to log
        params - the parameters to log
      • cleanUp

        public void cleanUp()
        Cleans up data structures, frees up memory.
        Specified by:
        cleanUp in interface CleanUpHandler
      • getLogger

        public static Logger getLogger​(String name)
        Returns a logger for the name.
        Parameters:
        name - the name of the logger
        Returns:
        the logger