Added an extra option to the logger class to display the method result while measuring performance
This commit is contained in:
parent
760b44d9f9
commit
ba9c6a24c0
|
@ -29,6 +29,11 @@ public class FRLogger {
|
|||
}
|
||||
|
||||
public static void traceExit(String perfId)
|
||||
{
|
||||
traceExit(perfId, null);
|
||||
}
|
||||
|
||||
public static void traceExit(String perfId, Object result)
|
||||
{
|
||||
var timeElapsed = Duration.between(perfData.get(perfId.hashCode()), java.time.Instant.now()).toMillis();
|
||||
|
||||
|
@ -36,6 +41,6 @@ public class FRLogger {
|
|||
if (timeElapsed < 0) {
|
||||
timeElapsed = 0;
|
||||
}
|
||||
logger.trace("Method '" + perfId + "' was performed in " + performanceFormat.format(timeElapsed/1000.0) + " seconds.");
|
||||
logger.trace("Method '" + perfId.replace("{}", result != null ? result.toString() : "(null)") + "' was performed in " + performanceFormat.format(timeElapsed/1000.0) + " seconds.");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue