Package Utils

Class Log


  • public class Log
    extends java.lang.Object
    Very simple logger. Could not find a simple enough existing one!
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Log.Level
      Represents different levels of message output.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void brief​(java.lang.String message)
      Log a new brief message
      static void critical​(java.lang.String message)
      Log a new critical message
      static void debug​(java.lang.String message)
      Log a new debug message
      static void detail​(java.lang.String message)
      Log a new detail message
      static org.apache.commons.configuration2.tree.ImmutableNode getConfig​(Log.Level level, java.io.File log)
      Get the config for a caller
      static void initialise​(org.apache.commons.configuration2.HierarchicalConfiguration<org.apache.commons.configuration2.tree.ImmutableNode> params)
      Initialise from a configuration
      static void initialise​(Log.Level level)
      Initialise a logger (logs to screen)
      static void initialise​(Log.Level level, java.io.File f)
      Initialise a logger (logs to file)
      static void log​(Log.Level level, java.lang.String message)
      Log a new message
      • Methods inherited from class java.lang.Object

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

      • log

        public static void log​(Log.Level level,
                               java.lang.String message)
        Log a new message
        Parameters:
        level - The level of the message
        message - The message
      • critical

        public static void critical​(java.lang.String message)
        Log a new critical message
        Parameters:
        message - The message
      • brief

        public static void brief​(java.lang.String message)
        Log a new brief message
        Parameters:
        message - The message
      • detail

        public static void detail​(java.lang.String message)
        Log a new detail message
        Parameters:
        message - The message
      • debug

        public static void debug​(java.lang.String message)
        Log a new debug message
        Parameters:
        message - The message
      • initialise

        public static void initialise​(org.apache.commons.configuration2.HierarchicalConfiguration<org.apache.commons.configuration2.tree.ImmutableNode> params)
                               throws OutputException
        Initialise from a configuration
        Parameters:
        params - Configuration
        Throws:
        OutputException - If there's a problem setting up the logger
      • initialise

        public static void initialise​(Log.Level level)
        Initialise a logger (logs to screen)
        Parameters:
        level - Level to log
      • initialise

        public static void initialise​(Log.Level level,
                                      java.io.File f)
                               throws java.io.IOException
        Initialise a logger (logs to file)
        Parameters:
        level - Level to log
        f - File to log to
        Throws:
        java.io.IOException - If there is a problem setting up the logger
      • getConfig

        public static org.apache.commons.configuration2.tree.ImmutableNode getConfig​(Log.Level level,
                                                                                     java.io.File log)
        Get the config for a caller
        Parameters:
        level - The level to log
        log - The file to log to. Null logs nothing.
        Returns:
        The config