Class Log


  • public final class Log
    extends Object
    The log interface. Use this class to add logging to your code.
    Author:
    gideon
    • Constructor Detail

      • Log

        public Log()
    • Method Detail

      • critical

        public static void critical​(String fmt,
                                    Object... args)
        Log critical event.
        Parameters:
        fmt - The message format string
        args - The message arguments
      • critical

        public static void critical​(Throwable ex)
        Log an exception as a critical error.
        Parameters:
        ex - The exception
      • critical

        public static void critical​(Throwable ex,
                                    String fmt,
                                    Object... args)
        Log an exception as a critical error.
        Parameters:
        ex - The exception
        fmt - The message format string
        args - The message arguments
      • error

        public static void error​(String fmt,
                                 Object... args)
        Log error event.
        Parameters:
        fmt - The message format string
        args - The message arguments
      • error

        public static void error​(Throwable ex)
        Log an exception as an error.
        Parameters:
        ex - The exception
      • error

        public static void error​(Throwable ex,
                                 String fmt,
                                 Object... args)
        Log an exception as an error.
        Parameters:
        ex - The exception
        fmt - The message format string
        args - The message arguments
      • warning

        public static void warning​(String fmt,
                                   Object... args)
        Log warning event.
        Parameters:
        fmt - The message format string
        args - The message arguments
      • warning

        public static void warning​(Throwable ex)
        Log an exception as a warning.
        Parameters:
        ex - The exception
      • warning

        public static void warning​(Throwable ex,
                                   String fmt,
                                   Object... args)
        Log an exception as a warning.
        Parameters:
        ex - The exception
        fmt - The message format string
        args - The message arguments
      • info

        public static void info​(String fmt,
                                Object... args)
        Log informational event.
        Parameters:
        fmt - The message format string
        args - The message arguments
      • debug

        public static void debug​(String fmt,
                                 Object... args)
        Log debug event.
        Parameters:
        fmt - The message format string
        args - The message arguments
      • debug

        public static void debug​(Supplier<String> msg)
        Log a debug event, while avoiding any expensive code unless the logging occurs. Use this when part of the building is expensive operations.
        Parameters:
        msg - A supplier that will provide the debug message when required.
      • setDefaultLogger

        public static void setDefaultLogger​(Logger logger)
        Set the default application logger. Only call this from your application's main code. This must not be called by libraries.
        Parameters:
        logger - The logger to use as default
      • setDefaultLevel

        public static void setDefaultLevel​(Level level)
        Set the default logging level. Only call this from your application's main code. This must not be called by libraries.
        Parameters:
        level - The default level to set.
      • setLogger

        public static void setLogger​(Logger logger)
        Set the logger for the package calling the logger.
        Parameters:
        logger - The logger to use for the package calling the method
      • setLogger

        public static void setLogger​(String name,
                                     Logger logger)
        Set the logger for the given name.
        Parameters:
        logger - The logger to use for the package calling the given name
      • setLevel

        public static void setLevel​(Level level)
        Set the log level for the package calling the logger.
        Parameters:
        level - The log level
      • setLevel

        public static void setLevel​(String name,
                                    Level level)
        Set the log level for the given name.
        Parameters:
        name - The name for which to set the level
        level - The log level