@InterfaceAudience.Public @InterfaceStability.Unstable public class DurationInfo extends OperationDuration implements AutoCloseable
close()
call.
This allows it to be used in a try-with-resources clause, and have the
duration automatically logged.Constructor and Description |
---|
DurationInfo(org.slf4j.Logger log,
boolean logAtInfo,
String format,
Object... args)
Create the duration text from a
String.format() code call
and log either at info or debug. |
DurationInfo(org.slf4j.Logger log,
String format,
Object... args)
Create the duration text from a
String.format() code call;
log output at info level. |
Modifier and Type | Method and Description |
---|---|
void |
close() |
String |
toString()
Return the duration as
OperationDuration.humanTime(long) . |
asDuration, finished, getDurationString, humanTime, time, value
public DurationInfo(org.slf4j.Logger log, String format, Object... args)
String.format()
code call;
log output at info level.log
- log to write toformat
- format stringargs
- list of argumentspublic DurationInfo(org.slf4j.Logger log, boolean logAtInfo, String format, Object... args)
String.format()
code call
and log either at info or debug.log
- log to write tologAtInfo
- should the log be at info, rather than debugformat
- format stringargs
- list of argumentspublic String toString()
OperationDuration
OperationDuration.humanTime(long)
.toString
in class OperationDuration
public void close()
close
in interface AutoCloseable
Copyright © 2022 Apache Software Foundation. All rights reserved.