Class BasicLambdaLogger

  • All Implemented Interfaces:
    LambdaLogger

    public final class BasicLambdaLogger
    extends java.lang.Object
    implements LambdaLogger
    • Method Summary

      Modifier and Type Method Description
      void debug​(java.util.function.Supplier<java.lang.String> message)  
      void debug​(java.util.function.Supplier<java.lang.String> message, java.lang.Throwable t)  
      void doIfDebugEnabled​(java.lang.Runnable work)
      Performs work only if DEBUG is enabled.
      void doIfInfoEnabled​(java.lang.Runnable work)
      Performs work only if INFO is enabled.
      void doIfTraceEnabled​(java.lang.Runnable work)
      Performs work only if TRACE is enabled.
      void error​(java.util.function.Supplier<java.lang.String> message)  
      void error​(java.util.function.Supplier<java.lang.String> message, java.lang.Throwable t)  
      void info​(java.util.function.Supplier<java.lang.String> message)  
      void info​(java.util.function.Supplier<java.lang.String> message, java.lang.Throwable t)  
      void logDurationIfDebugEnabled​(java.lang.Runnable timedWork, java.util.function.Supplier<java.lang.String> workDescriptionSupplier)
      Performs timedWork and if DEBUG is enabled, logs the time taken to do that work.
      <T> T logDurationIfDebugEnabled​(java.util.function.Supplier<T> timedWork, java.util.function.Supplier<java.lang.String> workDescriptionSupplier)
      Performs timedWork and if DEBUG is enabled, logs the time taken to do that work.
      void logDurationIfInfoEnabled​(java.lang.Runnable timedWork, java.util.function.Supplier<java.lang.String> workDescriptionSupplier)
      Performs timedWork and if INFO is enabled, logs the time taken to do that work.
      <T> T logDurationIfInfoEnabled​(java.util.function.Supplier<T> timedWork, java.util.function.Supplier<java.lang.String> workDescriptionSupplier)
      Performs timedWork and if INFO is enabled, logs the time taken to do that work.
      void logDurationIfTraceEnabled​(java.lang.Runnable timedWork, java.util.function.Supplier<java.lang.String> workDescriptionSupplier)
      Performs timedWork and if TRACE is enabled, logs the time taken to do that work.
      <T> T logDurationIfTraceEnabled​(java.util.function.Supplier<T> timedWork, java.util.function.Supplier<java.lang.String> workDescriptionSupplier)
      Performs timedWork and if TRACE is enabled, logs the time taken to do that work.
      void trace​(java.util.function.Supplier<java.lang.String> message)  
      void trace​(java.util.function.Supplier<java.lang.String> message, java.lang.Throwable t)  
      void warn​(java.util.function.Supplier<java.lang.String> message)  
      void warn​(java.util.function.Supplier<java.lang.String> message, java.lang.Throwable t)  
      • Methods inherited from class java.lang.Object

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

      • trace

        public void trace​(java.util.function.Supplier<java.lang.String> message)
        Specified by:
        trace in interface LambdaLogger
      • trace

        public void trace​(java.util.function.Supplier<java.lang.String> message,
                          java.lang.Throwable t)
        Specified by:
        trace in interface LambdaLogger
      • debug

        public void debug​(java.util.function.Supplier<java.lang.String> message)
        Specified by:
        debug in interface LambdaLogger
      • debug

        public void debug​(java.util.function.Supplier<java.lang.String> message,
                          java.lang.Throwable t)
        Specified by:
        debug in interface LambdaLogger
      • info

        public void info​(java.util.function.Supplier<java.lang.String> message)
        Specified by:
        info in interface LambdaLogger
      • info

        public void info​(java.util.function.Supplier<java.lang.String> message,
                         java.lang.Throwable t)
        Specified by:
        info in interface LambdaLogger
      • warn

        public void warn​(java.util.function.Supplier<java.lang.String> message)
        Specified by:
        warn in interface LambdaLogger
      • warn

        public void warn​(java.util.function.Supplier<java.lang.String> message,
                         java.lang.Throwable t)
        Specified by:
        warn in interface LambdaLogger
      • error

        public void error​(java.util.function.Supplier<java.lang.String> message)
        Specified by:
        error in interface LambdaLogger
      • error

        public void error​(java.util.function.Supplier<java.lang.String> message,
                          java.lang.Throwable t)
        Specified by:
        error in interface LambdaLogger
      • logDurationIfTraceEnabled

        public <T> T logDurationIfTraceEnabled​(java.util.function.Supplier<T> timedWork,
                                               java.util.function.Supplier<java.lang.String> workDescriptionSupplier)
        Description copied from interface: LambdaLogger
        Performs timedWork and if TRACE is enabled, logs the time taken to do that work. This cannot be used where the work throws a checked exception.
        Specified by:
        logDurationIfTraceEnabled in interface LambdaLogger
        Type Parameters:
        T - The type of the result of the work
        Parameters:
        timedWork - Work to perform and to time if required
        workDescriptionSupplier - A supplier of the description of the work to be added to the log message
        Returns:
        The result of the work
      • logDurationIfDebugEnabled

        public <T> T logDurationIfDebugEnabled​(java.util.function.Supplier<T> timedWork,
                                               java.util.function.Supplier<java.lang.String> workDescriptionSupplier)
        Description copied from interface: LambdaLogger
        Performs timedWork and if DEBUG is enabled, logs the time taken to do that work. This cannot be used where the work throws a checked exception.
        Specified by:
        logDurationIfDebugEnabled in interface LambdaLogger
        Type Parameters:
        T - The type of the result of the work
        Parameters:
        timedWork - Work to perform and to time if required
        workDescriptionSupplier - The name of the work to be added to the log message
        Returns:
        The result of the work
      • logDurationIfInfoEnabled

        public <T> T logDurationIfInfoEnabled​(java.util.function.Supplier<T> timedWork,
                                              java.util.function.Supplier<java.lang.String> workDescriptionSupplier)
        Description copied from interface: LambdaLogger
        Performs timedWork and if INFO is enabled, logs the time taken to do that work. This cannot be used where the work throws a checked exception.
        Specified by:
        logDurationIfInfoEnabled in interface LambdaLogger
        Type Parameters:
        T - The type of the result of the work
        Parameters:
        timedWork - Work to perform and to time if required
        workDescriptionSupplier - The name of the work to be added to the log message
        Returns:
        The result of the work
      • logDurationIfTraceEnabled

        public void logDurationIfTraceEnabled​(java.lang.Runnable timedWork,
                                              java.util.function.Supplier<java.lang.String> workDescriptionSupplier)
        Description copied from interface: LambdaLogger
        Performs timedWork and if TRACE is enabled, logs the time taken to do that work. This cannot be used where the work throws a checked exception.
        Specified by:
        logDurationIfTraceEnabled in interface LambdaLogger
        Parameters:
        timedWork - Work to perform and to time if required
        workDescriptionSupplier - The name of the work to be added to the log message
      • logDurationIfDebugEnabled

        public void logDurationIfDebugEnabled​(java.lang.Runnable timedWork,
                                              java.util.function.Supplier<java.lang.String> workDescriptionSupplier)
        Description copied from interface: LambdaLogger
        Performs timedWork and if DEBUG is enabled, logs the time taken to do that work. This cannot be used where the work throws a checked exception.
        Specified by:
        logDurationIfDebugEnabled in interface LambdaLogger
        Parameters:
        timedWork - Work to perform and to time if required
        workDescriptionSupplier - The name of the work to be added to the log message
      • logDurationIfInfoEnabled

        public void logDurationIfInfoEnabled​(java.lang.Runnable timedWork,
                                             java.util.function.Supplier<java.lang.String> workDescriptionSupplier)
        Description copied from interface: LambdaLogger
        Performs timedWork and if INFO is enabled, logs the time taken to do that work. This cannot be used where the work throws a checked exception.
        Specified by:
        logDurationIfInfoEnabled in interface LambdaLogger
        Parameters:
        timedWork - Work to perform and to time if required
        workDescriptionSupplier - The name of the work to be added to the log message
      • doIfTraceEnabled

        public void doIfTraceEnabled​(java.lang.Runnable work)
        Description copied from interface: LambdaLogger
        Performs work only if TRACE is enabled.
        Specified by:
        doIfTraceEnabled in interface LambdaLogger
        Parameters:
        work - The work to perform.
      • doIfDebugEnabled

        public void doIfDebugEnabled​(java.lang.Runnable work)
        Description copied from interface: LambdaLogger
        Performs work only if DEBUG is enabled.
        Specified by:
        doIfDebugEnabled in interface LambdaLogger
        Parameters:
        work - The work to perform.
      • doIfInfoEnabled

        public void doIfInfoEnabled​(java.lang.Runnable work)
        Description copied from interface: LambdaLogger
        Performs work only if INFO is enabled.
        Specified by:
        doIfInfoEnabled in interface LambdaLogger
        Parameters:
        work - The work to perform.