Package stroom.query.util
Class BasicLambdaLogger
- java.lang.Object
-
- stroom.query.util.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
-
Methods inherited from interface stroom.query.util.LambdaLogger
logDurationIfDebugEnabled, logDurationIfDebugEnabled, logDurationIfInfoEnabled, logDurationIfInfoEnabled, logDurationIfTraceEnabled, logDurationIfTraceEnabled
-
-
-
-
Method Detail
-
trace
public void trace(java.util.function.Supplier<java.lang.String> message)
- Specified by:
trace
in interfaceLambdaLogger
-
trace
public void trace(java.util.function.Supplier<java.lang.String> message, java.lang.Throwable t)
- Specified by:
trace
in interfaceLambdaLogger
-
debug
public void debug(java.util.function.Supplier<java.lang.String> message)
- Specified by:
debug
in interfaceLambdaLogger
-
debug
public void debug(java.util.function.Supplier<java.lang.String> message, java.lang.Throwable t)
- Specified by:
debug
in interfaceLambdaLogger
-
info
public void info(java.util.function.Supplier<java.lang.String> message)
- Specified by:
info
in interfaceLambdaLogger
-
info
public void info(java.util.function.Supplier<java.lang.String> message, java.lang.Throwable t)
- Specified by:
info
in interfaceLambdaLogger
-
warn
public void warn(java.util.function.Supplier<java.lang.String> message)
- Specified by:
warn
in interfaceLambdaLogger
-
warn
public void warn(java.util.function.Supplier<java.lang.String> message, java.lang.Throwable t)
- Specified by:
warn
in interfaceLambdaLogger
-
error
public void error(java.util.function.Supplier<java.lang.String> message)
- Specified by:
error
in interfaceLambdaLogger
-
error
public void error(java.util.function.Supplier<java.lang.String> message, java.lang.Throwable t)
- Specified by:
error
in interfaceLambdaLogger
-
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 interfaceLambdaLogger
- Type Parameters:
T
- The type of the result of the work- Parameters:
timedWork
- Work to perform and to time if requiredworkDescriptionSupplier
- 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 interfaceLambdaLogger
- Type Parameters:
T
- The type of the result of the work- Parameters:
timedWork
- Work to perform and to time if requiredworkDescriptionSupplier
- 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 interfaceLambdaLogger
- Type Parameters:
T
- The type of the result of the work- Parameters:
timedWork
- Work to perform and to time if requiredworkDescriptionSupplier
- 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 interfaceLambdaLogger
- Parameters:
timedWork
- Work to perform and to time if requiredworkDescriptionSupplier
- 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 interfaceLambdaLogger
- Parameters:
timedWork
- Work to perform and to time if requiredworkDescriptionSupplier
- 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 interfaceLambdaLogger
- Parameters:
timedWork
- Work to perform and to time if requiredworkDescriptionSupplier
- 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 interfaceLambdaLogger
- 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 interfaceLambdaLogger
- 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 interfaceLambdaLogger
- Parameters:
work
- The work to perform.
-
-