Class DefaultLoggerFormatter

    • Constructor Detail

      • DefaultLoggerFormatter

        public DefaultLoggerFormatter()
    • Method Detail

      • format

        public String format​(Level logLevel,
                             String message,
                             @Nullable
                             Throwable throwable)
        Description copied from interface: LoggerFormatter
        Formats the inputs into a string that will be printed.
        Specified by:
        format in interface LoggerFormatter
        Parameters:
        logLevel - the log level.
        message - the message.
        throwable - the throwable, which can be null.
        Returns:
        the formatted string that will be printed onto the console.
      • timestamp

        protected String timestamp()
        Returns a timestamp to be included in the default output log format.
        Returns:
        a timestamp or date format, might be null or empty.
      • logLevel

        protected String logLevel​(Level level)
        Converts the log level enum to its string representation.

        Note that in the default implementation, the aim is to preserve the length of the log levels so some levels are prefixed with whitespace - this is not a typo.

        Parameters:
        level - the level to convert.
        Returns:
        the converted level.