Class Logger


  • public class Logger
    extends java.lang.Object
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Logger.LogLevel  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Logger​(java.lang.Class<?> clazz, Logger.LogLevel logLevel, java.time.format.DateTimeFormatter dateFormat, java.io.PrintStream printStream)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void debug​(java.lang.String message, java.lang.Object... args)
      Output a message at the DEBUG Logger.LogLevel.
      void error​(java.lang.String message, java.lang.Object... args)
      Output a message at the ERROR Logger.LogLevel.
      void fatal​(java.lang.String message, java.lang.Object... args)
      Output a message at the FATAL Logger.LogLevel.
      static Logger getLogger​(java.lang.Class<?> clazz)
      Returns a Logger for the given Class.
      static Logger getLogger​(java.lang.Class<?> clazz, Logger.LogLevel logLevel)
      Returns a Logger for the given Class and LogLevel.
      static Logger getLogger​(java.lang.Class<?> clazz, Logger.LogLevel logLevel, java.io.PrintStream printStream)
      Returns a Logger for the given Class and LogLevel and PrintStream.
      static Logger getLogger​(java.lang.Class<?> clazz, Logger.LogLevel logLevel, java.time.format.DateTimeFormatter dateFormat, java.io.PrintStream printStream)
      Returns a Logger for the given Class, LogLevel, DateTimeFormatter, and PrintStream.
      void info​(java.lang.String message, java.lang.Object... args)
      Output a message at the INFO Logger.LogLevel.
      boolean isDebugEnabled()  
      boolean isErrorEnabled()  
      boolean isFatalEnabled()  
      boolean isInfoEnabled()  
      boolean isTraceEnabled()  
      boolean isWarnEnabled()  
      private void log​(Logger.LogLevel logLevel, java.lang.String message, java.lang.Object... args)  
      void trace​(java.lang.String message, java.lang.Object... args)
      Output a message at the TRACE Logger.LogLevel.
      void warn​(java.lang.String message, java.lang.Object... args)
      Output a message at the WARN Logger.LogLevel.
      • Methods inherited from class java.lang.Object

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

      • DEFAULT_DATE_FORMAT

        static final java.time.format.DateTimeFormatter DEFAULT_DATE_FORMAT
      • className

        private final java.lang.String className
      • dateFormat

        private final java.time.format.DateTimeFormatter dateFormat
      • printStream

        private final java.io.PrintStream printStream
    • Constructor Detail

      • Logger

        private Logger​(java.lang.Class<?> clazz,
                       Logger.LogLevel logLevel,
                       java.time.format.DateTimeFormatter dateFormat,
                       java.io.PrintStream printStream)
    • Method Detail

      • getLogger

        public static Logger getLogger​(java.lang.Class<?> clazz)
        Returns a Logger for the given Class. The fully qualified class name is printed on each log line.
        Parameters:
        clazz - The class to be logged
      • getLogger

        public static Logger getLogger​(java.lang.Class<?> clazz,
                                       Logger.LogLevel logLevel)
        Returns a Logger for the given Class and LogLevel. The fully qualified class name is printed on each log line.
        Parameters:
        clazz - The class to be logged
      • getLogger

        public static Logger getLogger​(java.lang.Class<?> clazz,
                                       Logger.LogLevel logLevel,
                                       java.io.PrintStream printStream)
        Returns a Logger for the given Class and LogLevel and PrintStream. The fully qualified class name is printed on each log line.
        Parameters:
        clazz - The class to be logged
      • getLogger

        public static Logger getLogger​(java.lang.Class<?> clazz,
                                       Logger.LogLevel logLevel,
                                       java.time.format.DateTimeFormatter dateFormat,
                                       java.io.PrintStream printStream)
        Returns a Logger for the given Class, LogLevel, DateTimeFormatter, and PrintStream. The fully qualified class name is printed on each log line.
        Parameters:
        clazz - The class to be logged
      • isTraceEnabled

        public boolean isTraceEnabled()
        Returns:
        true if the TRACE Logger.LogLevel is enabled.
      • isDebugEnabled

        public boolean isDebugEnabled()
        Returns:
        true if the DEBUG Logger.LogLevel is enabled.
      • isInfoEnabled

        public boolean isInfoEnabled()
        Returns:
        true if the INFO Logger.LogLevel is enabled.
      • isWarnEnabled

        public boolean isWarnEnabled()
        Returns:
        true if the WARN Logger.LogLevel is enabled.
      • isErrorEnabled

        public boolean isErrorEnabled()
        Returns:
        true if the ERROR Logger.LogLevel is enabled.
      • isFatalEnabled

        public boolean isFatalEnabled()
        Returns:
        true if the FATAL Logger.LogLevel is enabled.
      • trace

        public void trace​(java.lang.String message,
                          java.lang.Object... args)
        Output a message at the TRACE Logger.LogLevel.
        Parameters:
        message - The message to output.
        args - Arguments to be substituted for {} in the message String.
      • debug

        public void debug​(java.lang.String message,
                          java.lang.Object... args)
        Output a message at the DEBUG Logger.LogLevel.
        Parameters:
        message - The message to output.
        args - Arguments to be substituted for {} in the message String.
      • info

        public void info​(java.lang.String message,
                         java.lang.Object... args)
        Output a message at the INFO Logger.LogLevel.
        Parameters:
        message - The message to output.
        args - Arguments to be substituted for {} in the message String.
      • warn

        public void warn​(java.lang.String message,
                         java.lang.Object... args)
        Output a message at the WARN Logger.LogLevel.
        Parameters:
        message - The message to output.
        args - Arguments to be substituted for {} in the message String.
      • error

        public void error​(java.lang.String message,
                          java.lang.Object... args)
        Output a message at the ERROR Logger.LogLevel.
        Parameters:
        message - The message to output.
        args - Arguments to be substituted for {} in the message String.
      • fatal

        public void fatal​(java.lang.String message,
                          java.lang.Object... args)
        Output a message at the FATAL Logger.LogLevel.
        Parameters:
        message - The message to output.
        args - Arguments to be substituted for {} in the message String.
      • log

        private void log​(Logger.LogLevel logLevel,
                         java.lang.String message,
                         java.lang.Object... args)