Class Logger

    • Constructor Detail

      • Logger

        protected Logger​(Class<?> clazz)
      • Logger

        protected Logger​(String name)
    • Method Detail

      • init

        public Logger init()
        Method invoked on initialisation
        Returns:
        self
      • name

        public String name()
        Returns:
        Returns logger name
      • level

        public LogLevel level()
        Returns:
        Returns log level
      • formatter

        public LogFormatter formatter()
        Returns:
        Returns configured message formatter
      • formatter

        public Logger formatter​(LogFormatter formatter)
        Sets the message formatter
        Parameters:
        formatter - new formatter
        Returns:
        self
      • writer

        public LogWriter writer()
        Returns:
        Returns configured message writer
      • writer

        public Logger writer​(LogWriter writer)
        Sets the configured message writer
        Parameters:
        writer - new writer
        Returns:
        self
      • config

        public Logger config​(Map<String,​String> config)
        adds or updates config values for the logger, formatter and writer
        Parameters:
        config - new configs
        Returns:
        self
      • updateConfig

        public Logger updateConfig()
        adds or overwrites config values for the logger, formatter and writer
        Returns:
        self
      • configLoader

        public LoggerConfigLoader configLoader()
        Returns:
        Returns the config loader
      • log

        public void log​(LogLevel level,
                        Supplier<String> msg,
                        Supplier<Throwable> throwable)
        logs message using formatter and writer
        Parameters:
        level - log level to verify if message should be logged
        msg - msg message which will only be loaded if level is active
        throwable - optional if an exception happened
      • getAll

        public static Set<Logger> getAll()
        Returns:
        all every registered logger
      • remove

        public static boolean remove​(Logger logger)
        Removes logger from registry
        Parameters:
        logger - Logger to be removed from this set, if present
        Returns:
        Returns: true if this set contained the specified element
      • add

        public static Logger add​(Logger logger)
        Registers a new logger
        Parameters:
        logger - new logger to register
        Returns:
        new logger or previous logger if there is already a registered one
      • add

        public static Logger add​(Logger logger,
                                 boolean replace)
        Registers a new logger
        Parameters:
        logger - new logger to register
        replace - replace old logger if the same logger already exists
        Returns:
        new logger or previous logger if there is already a registered one and replace is set to false
      • defaultLogger

        public static Logger defaultLogger()
        Returns:
        default logger
      • defaultLogger

        public static Logger defaultLogger​(String name)
        Returns:
        default logger
      • getExecutor

        public static Executor getExecutor()
        Initialises new Executor if not present
        Returns:
        Executor
      • isRunning

        public static boolean isRunning()
        Returns:
        true if the executor is used and active threads are running
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object