Package de.bmiag.tapir.util.logger
Class ExecutionTimeLogger
- java.lang.Object
-
- de.bmiag.tapir.util.logger.ExecutionTimeLogger
-
public class ExecutionTimeLogger extends java.lang.Object
Logs the execution time of the passed supplier.- Since:
- 2.0.0
- Author:
- Oliver Libutzki <[email protected]>
-
-
Constructor Summary
Constructors Constructor Description ExecutionTimeLogger()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> T
logExecutionTime(org.apache.logging.log4j.Logger logger, java.lang.String logPrefix, java.util.function.Supplier<? extends T> supplier)
Logs the execution time of the passed supplier.static <T> T
logExecutionTime(org.apache.logging.log4j.Logger logger, java.util.function.Supplier<java.lang.String> logPrefix, java.util.function.Supplier<? extends T> supplier)
Logs the execution time of the passed supplier.
-
-
-
Method Detail
-
logExecutionTime
public static <T> T logExecutionTime(org.apache.logging.log4j.Logger logger, java.util.function.Supplier<java.lang.String> logPrefix, java.util.function.Supplier<? extends T> supplier)
Logs the execution time of the passed supplier.- Type Parameters:
T
- return type- Parameters:
logger
- the logger which should be usedlogPrefix
- log prefix suppliersupplier
- supplier which holds the code which's execution time should be measured and logged- Returns:
- The return value of the given supplier
- Since:
- 2.0.0
-
logExecutionTime
public static <T> T logExecutionTime(org.apache.logging.log4j.Logger logger, java.lang.String logPrefix, java.util.function.Supplier<? extends T> supplier)
Logs the execution time of the passed supplier.- Type Parameters:
T
- return type- Parameters:
logger
- the logger which should be usedlogPrefix
- log prefixsupplier
- supplier which holds the code which's execution time should be measured and logged- Returns:
- The return value of the given supplier
- Since:
- 2.0.0
-
-