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 voiddebug(java.util.function.Supplier<java.lang.String> message)voiddebug(java.util.function.Supplier<java.lang.String> message, java.lang.Throwable t)voiddoIfDebugEnabled(java.lang.Runnable work)Performs work only if DEBUG is enabled.voiddoIfInfoEnabled(java.lang.Runnable work)Performs work only if INFO is enabled.voiddoIfTraceEnabled(java.lang.Runnable work)Performs work only if TRACE is enabled.voiderror(java.util.function.Supplier<java.lang.String> message)voiderror(java.util.function.Supplier<java.lang.String> message, java.lang.Throwable t)voidinfo(java.util.function.Supplier<java.lang.String> message)voidinfo(java.util.function.Supplier<java.lang.String> message, java.lang.Throwable t)voidlogDurationIfDebugEnabled(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> TlogDurationIfDebugEnabled(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.voidlogDurationIfInfoEnabled(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> TlogDurationIfInfoEnabled(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.voidlogDurationIfTraceEnabled(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> TlogDurationIfTraceEnabled(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.voidtrace(java.util.function.Supplier<java.lang.String> message)voidtrace(java.util.function.Supplier<java.lang.String> message, java.lang.Throwable t)voidwarn(java.util.function.Supplier<java.lang.String> message)voidwarn(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:
tracein interfaceLambdaLogger
-
trace
public void trace(java.util.function.Supplier<java.lang.String> message, java.lang.Throwable t)- Specified by:
tracein interfaceLambdaLogger
-
debug
public void debug(java.util.function.Supplier<java.lang.String> message)
- Specified by:
debugin interfaceLambdaLogger
-
debug
public void debug(java.util.function.Supplier<java.lang.String> message, java.lang.Throwable t)- Specified by:
debugin interfaceLambdaLogger
-
info
public void info(java.util.function.Supplier<java.lang.String> message)
- Specified by:
infoin interfaceLambdaLogger
-
info
public void info(java.util.function.Supplier<java.lang.String> message, java.lang.Throwable t)- Specified by:
infoin interfaceLambdaLogger
-
warn
public void warn(java.util.function.Supplier<java.lang.String> message)
- Specified by:
warnin interfaceLambdaLogger
-
warn
public void warn(java.util.function.Supplier<java.lang.String> message, java.lang.Throwable t)- Specified by:
warnin interfaceLambdaLogger
-
error
public void error(java.util.function.Supplier<java.lang.String> message)
- Specified by:
errorin interfaceLambdaLogger
-
error
public void error(java.util.function.Supplier<java.lang.String> message, java.lang.Throwable t)- Specified by:
errorin interfaceLambdaLogger
-
logDurationIfTraceEnabled
public <T> T logDurationIfTraceEnabled(java.util.function.Supplier<T> timedWork, java.util.function.Supplier<java.lang.String> workDescriptionSupplier)Description copied from interface:LambdaLoggerPerforms 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:
logDurationIfTraceEnabledin 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:LambdaLoggerPerforms 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:
logDurationIfDebugEnabledin 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:LambdaLoggerPerforms 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:
logDurationIfInfoEnabledin 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:LambdaLoggerPerforms 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:
logDurationIfTraceEnabledin 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:LambdaLoggerPerforms 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:
logDurationIfDebugEnabledin 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:LambdaLoggerPerforms 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:
logDurationIfInfoEnabledin 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:LambdaLoggerPerforms work only if TRACE is enabled.- Specified by:
doIfTraceEnabledin interfaceLambdaLogger- Parameters:
work- The work to perform.
-
doIfDebugEnabled
public void doIfDebugEnabled(java.lang.Runnable work)
Description copied from interface:LambdaLoggerPerforms work only if DEBUG is enabled.- Specified by:
doIfDebugEnabledin interfaceLambdaLogger- Parameters:
work- The work to perform.
-
doIfInfoEnabled
public void doIfInfoEnabled(java.lang.Runnable work)
Description copied from interface:LambdaLoggerPerforms work only if INFO is enabled.- Specified by:
doIfInfoEnabledin interfaceLambdaLogger- Parameters:
work- The work to perform.
-
-