Class Logger

  • All Implemented Interfaces:

    
    public final class Logger
    
                        

    Logger class with Kotlin usability improvements. It is backed by a System.Logger instance.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private final String name
    • Constructor Summary

      Constructors 
      Constructor Description
      Logger(KClass<?> type) Logger class with Kotlin improvements like lazy evaluation.
      Logger(String name, System.Logger logger)
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final String getName()
      final Boolean isLoggable(System.Logger.Level level) Check if this logger is enabled for a given log level.
      final <E extends Throwable> Unit log(System.Logger.Level level, E exception, Function1<E, Object> message) Log a message, with associated exception information.
      final Unit log(System.Logger.Level level, Function0<Object> message) Log a message.
      final Unit trace(Function0<Object> message) Log a message using TRACE level.
      final Unit debug(Function0<Object> message) Log a message using DEBUG level.
      final Unit info(Function0<Object> message) Log a message using INFO level.
      final Unit warn(Function0<Object> message) Log a message using WARNING level.
      final <E extends Throwable> Unit warn(E exception, Function1<E, Object> message) Log a message using WARNING level with associated exception information.
      final Unit error(Function0<Object> message) Log a message using ERROR level.
      final <E extends Throwable> Unit error(E exception, Function1<E, Object> message) Log a message using ERROR level with associated exception information.
      • Methods inherited from class java.lang.Object

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

      • Logger

        Logger(KClass<?> type)
        Logger class with Kotlin improvements like lazy evaluation.
        Parameters:
        type - Logger type.
      • Logger

        Logger(String name, System.Logger logger)
        Parameters:
        name - Logger name.
    • Method Detail

      • isLoggable

         final Boolean isLoggable(System.Logger.Level level)

        Check if this logger is enabled for a given log level.

        Parameters:
        level - Level to check.
        Returns:

        True if this logger is enabled for the supplied level.

      • log

         final <E extends Throwable> Unit log(System.Logger.Level level, E exception, Function1<E, Object> message)

        Log a message, with associated exception information.

        Parameters:
        level - Level used in the log statement.
        exception - The exception associated with log message.
        message - The message supplier to use in the log statement.
      • log

         final Unit log(System.Logger.Level level, Function0<Object> message)

        Log a message.

        Parameters:
        level - Level used in the log statement.
        message - The message supplier to use in the log statement.
      • trace

         final Unit trace(Function0<Object> message)

        Log a message using TRACE level.

        Parameters:
        message - The required message to log.
      • debug

         final Unit debug(Function0<Object> message)

        Log a message using DEBUG level.

        Parameters:
        message - The required message to log.
      • info

         final Unit info(Function0<Object> message)

        Log a message using INFO level.

        Parameters:
        message - The required message to log.
      • warn

         final Unit warn(Function0<Object> message)

        Log a message using WARNING level.

        Parameters:
        message - The required message to log.
      • warn

         final <E extends Throwable> Unit warn(E exception, Function1<E, Object> message)

        Log a message using WARNING level with associated exception information.

        Parameters:
        exception - The exception associated with log message.
        message - The message to log (optional).
      • error

         final Unit error(Function0<Object> message)

        Log a message using ERROR level.

        Parameters:
        message - The required message to log.
      • error

         final <E extends Throwable> Unit error(E exception, Function1<E, Object> message)

        Log a message using ERROR level with associated exception information.

        Parameters:
        exception - The exception associated with log message.
        message - The message to log (function to optional).