Class ConsoleLogger

  • All Implemented Interfaces:
    Logger

    public class ConsoleLogger
    extends java.lang.Object
    A class for sending log messages to standard output stream.
    • Constructor Summary

      Constructors 
      Constructor Description
      ConsoleLogger()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String formatLog​(LogLevel level, java.lang.String domain, java.lang.String message)  
      java.util.EnumSet<LogDomain> getDomains()
      Gets the domains that will be considered for writing to the console log.
      LogLevel getLevel()
      Gets the level that will be logged via this logger.
      static java.io.PrintStream getLogStream​(LogLevel level)  
      void log​(LogLevel level, LogDomain domain, java.lang.String message)
      Performs the actual logging logic
      void setDomains​(LogDomain... domains)
      Sets the domains that will be considered for writing to the console log.
      void setDomains​(java.util.EnumSet<LogDomain> domains)
      Sets the domains that will be considered for writing to the console log.
      void setLevel​(LogLevel level)
      Sets the overall logging level that will be written to the console log.
      • Methods inherited from class java.lang.Object

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

      • ConsoleLogger

        public ConsoleLogger()
    • Method Detail

      • getLogStream

        @NonNull
        public static java.io.PrintStream getLogStream​(@NonNull
                                                       LogLevel level)
      • formatLog

        @NonNull
        public static java.lang.String formatLog​(@NonNull
                                                 LogLevel level,
                                                 @NonNull
                                                 java.lang.String domain,
                                                 @NonNull
                                                 java.lang.String message)
      • log

        public void log​(@NonNull
                        LogLevel level,
                        @NonNull
                        LogDomain domain,
                        @NonNull
                        java.lang.String message)
        Description copied from interface: Logger
        Performs the actual logging logic
        Specified by:
        log in interface Logger
        Parameters:
        level - The level of the message to log
        domain - The domain of the message to log
        message - The content of the message to log
      • getLevel

        @NonNull
        public LogLevel getLevel()
        Description copied from interface: Logger
        Gets the level that will be logged via this logger.
        Specified by:
        getLevel in interface Logger
        Returns:
        The maximum level to log
      • setLevel

        public void setLevel​(@NonNull
                             LogLevel level)
        Sets the overall logging level that will be written to the console log.
        Parameters:
        level - The lowest (most verbose) level to include in the logs
      • getDomains

        @NonNull
        public java.util.EnumSet<LogDomain> getDomains()
        Gets the domains that will be considered for writing to the console log.
        Returns:
        The currently active domains
      • setDomains

        public void setDomains​(@NonNull
                               java.util.EnumSet<LogDomain> domains)
        Sets the domains that will be considered for writing to the console log.
        Parameters:
        domains - The domains to make active
      • setDomains

        public void setDomains​(@NonNull
                               LogDomain... domains)
        Sets the domains that will be considered for writing to the console log.
        Parameters:
        domains - The domains to make active (vararg)