public final class LoggerStopwatch extends Object implements Stopwatch
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_LOGGER_NAME
Default logger name used by this timer if no other logger is named.
|
static String |
MESSAGE_FORMAT_ELAPSED
Stopwatch message format string.
|
static String |
MESSAGE_FORMAT_SPLIT
Stopwatch message format string.
|
Modifier and Type | Method and Description |
---|---|
void |
elapsed(String msg)
Record the elapsed time since the stopwatch was started/restarted.
|
void |
elapsed(String msg,
Object... args)
Record the elapsed time since the stopwatch was started/restarted.
|
static Stopwatch |
getInstance()
Create a stopwatch using the default logger, if debug is enabled.
|
static Stopwatch |
getInstance(org.slf4j.Logger logger)
Create a logger stopwatch using the logger specified.
|
static Stopwatch |
getInstance(String logger)
Create a logger stopwatch using the logger specified.
|
void |
split(String msg)
Record time elapsed since the last interval measurement or since started/restarted.
|
void |
split(String msg,
Object... args)
Record time elapsed since the last interval measurement or since started/restarted.
|
void |
start()
Starts the stopwatch.
|
public static final String DEFAULT_LOGGER_NAME
public static final String MESSAGE_FORMAT_SPLIT
public static final String MESSAGE_FORMAT_ELAPSED
public static Stopwatch getInstance(org.slf4j.Logger logger)
logger
- logger instanceNoopStopwatch
public static Stopwatch getInstance(String logger)
logger
- logger instanceNoopStopwatch
public static Stopwatch getInstance()
NoopStopwatch
,
DEFAULT_LOGGER_NAME
public void start()
Stopwatch
public void split(String msg)
Stopwatch
public void split(String msg, Object... args)
Stopwatch
split
in interface Stopwatch
msg
- message to record (typically a description of the functionality measured, like a component name.)args
- arguments to be substituted into the message. Parameterization operates as in slf4j:
http://www.slf4j.org/faq.html#logging_performancepublic void elapsed(String msg)
Stopwatch
public void elapsed(String msg, Object... args)
Stopwatch
elapsed
in interface Stopwatch
msg
- message to record (typically a description of the functionality measured, like a component name.)args
- arguments to be substituted into the message. Parameterization operates as in slf4j:
http://www.slf4j.org/faq.html#logging_performanceCopyright © 2010–2017. All rights reserved.