Package stroom.query.util
Interface LambdaLogger
-
- All Known Implementing Classes:
BasicLambdaLogger
public interface LambdaLogger
-
-
Method Summary
Modifier and Type Method Description static java.lang.String
buildMessage(java.lang.String format, java.lang.Object... args)
Constructs a formatted message string using a format string that takes the same placeholders as SLF4J, e.g.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)
default void
logDurationIfDebugEnabled(java.lang.Runnable timedWork, java.lang.String workDescription)
Performs timedWork and if DEBUG is enabled, logs the time taken to do that work.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.default <T> T
logDurationIfDebugEnabled(java.util.function.Supplier<T> timedWork, java.lang.String workDescription)
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.default void
logDurationIfInfoEnabled(java.lang.Runnable timedWork, java.lang.String workDescription)
Performs timedWork and if INFO 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.default <T> T
logDurationIfInfoEnabled(java.util.function.Supplier<T> timedWork, java.lang.String workDescription)
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.default void
logDurationIfTraceEnabled(java.lang.Runnable timedWork, java.lang.String workDescription)
Performs timedWork and if TRACE 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.default <T> T
logDurationIfTraceEnabled(java.util.function.Supplier<T> timedWork, java.lang.String workDescription)
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)
-
-
-
Method Detail
-
trace
void trace(java.util.function.Supplier<java.lang.String> message)
-
trace
void trace(java.util.function.Supplier<java.lang.String> message, java.lang.Throwable t)
-
debug
void debug(java.util.function.Supplier<java.lang.String> message)
-
debug
void debug(java.util.function.Supplier<java.lang.String> message, java.lang.Throwable t)
-
info
void info(java.util.function.Supplier<java.lang.String> message)
-
info
void info(java.util.function.Supplier<java.lang.String> message, java.lang.Throwable t)
-
warn
void warn(java.util.function.Supplier<java.lang.String> message)
-
warn
void warn(java.util.function.Supplier<java.lang.String> message, java.lang.Throwable t)
-
error
void error(java.util.function.Supplier<java.lang.String> message)
-
error
void error(java.util.function.Supplier<java.lang.String> message, java.lang.Throwable t)
-
logDurationIfTraceEnabled
default <T> T logDurationIfTraceEnabled(java.util.function.Supplier<T> timedWork, java.lang.String workDescription)
Performs timedWork and if TRACE is enabled, logs the time taken to do that work- Type Parameters:
T
- The type of the result of the work- Parameters:
timedWork
- Work to perform and to time if requiredworkDescription
- The name of the work to be added to the log message- Returns:
- The result of the work
-
logDurationIfTraceEnabled
<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. This cannot be used where the work throws a checked exception.- 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
default <T> T logDurationIfDebugEnabled(java.util.function.Supplier<T> timedWork, java.lang.String workDescription)
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.- Type Parameters:
T
- The type of the result of the work- Parameters:
timedWork
- Work to perform and to time if requiredworkDescription
- The name of the work to be added to the log message- Returns:
- The result of the work
-
logDurationIfDebugEnabled
<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. This cannot be used where the work throws a checked exception.- 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
default <T> T logDurationIfInfoEnabled(java.util.function.Supplier<T> timedWork, java.lang.String workDescription)
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.- Type Parameters:
T
- The type of the result of the work- Parameters:
timedWork
- Work to perform and to time if requiredworkDescription
- The name of the work to be added to the log message- Returns:
- The result of the work
-
logDurationIfInfoEnabled
<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. This cannot be used where the work throws a checked exception.- 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
default void logDurationIfTraceEnabled(java.lang.Runnable timedWork, java.lang.String workDescription)
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.- Parameters:
timedWork
- Work to perform and to time if requiredworkDescription
- The name of the work to be added to the log message
-
logDurationIfTraceEnabled
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. This cannot be used where the work throws a checked exception.- Parameters:
timedWork
- Work to perform and to time if requiredworkDescriptionSupplier
- The name of the work to be added to the log message
-
logDurationIfDebugEnabled
default void logDurationIfDebugEnabled(java.lang.Runnable timedWork, java.lang.String workDescription)
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.- Parameters:
timedWork
- Work to perform and to time if requiredworkDescription
- The name of the work to be added to the log message
-
logDurationIfDebugEnabled
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. This cannot be used where the work throws a checked exception.- Parameters:
timedWork
- Work to perform and to time if requiredworkDescriptionSupplier
- The name of the work to be added to the log message
-
logDurationIfInfoEnabled
default void logDurationIfInfoEnabled(java.lang.Runnable timedWork, java.lang.String workDescription)
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.- Parameters:
timedWork
- Work to perform and to time if requiredworkDescription
- The name of the work to be added to the log message
-
logDurationIfInfoEnabled
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. This cannot be used where the work throws a checked exception.- Parameters:
timedWork
- Work to perform and to time if requiredworkDescriptionSupplier
- The name of the work to be added to the log message
-
doIfTraceEnabled
void doIfTraceEnabled(java.lang.Runnable work)
Performs work only if TRACE is enabled.- Parameters:
work
- The work to perform.
-
doIfDebugEnabled
void doIfDebugEnabled(java.lang.Runnable work)
Performs work only if DEBUG is enabled.- Parameters:
work
- The work to perform.
-
doIfInfoEnabled
void doIfInfoEnabled(java.lang.Runnable work)
Performs work only if INFO is enabled.- Parameters:
work
- The work to perform.
-
buildMessage
static java.lang.String buildMessage(java.lang.String format, java.lang.Object... args)
Constructs a formatted message string using a format string that takes the same placeholders as SLF4J, e.g. "Function called with name {} and value {}"- Parameters:
format
- SLF4J style format stringargs
- The values for any placeholders in the message format- Returns:
- A formatted message
-
-