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 instanceNoopStopwatchpublic static Stopwatch getInstance(String logger)
logger - logger instanceNoopStopwatchpublic static Stopwatch getInstance()
NoopStopwatch,
DEFAULT_LOGGER_NAMEpublic void start()
Stopwatchpublic void split(String msg)
Stopwatchpublic void split(String msg, Object... args)
Stopwatchsplit in interface Stopwatchmsg - 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)
Stopwatchpublic void elapsed(String msg, Object... args)
Stopwatchelapsed in interface Stopwatchmsg - 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.