Package com.illumon.util
Class Utils.Timer
java.lang.Object
com.illumon.util.Utils.Timer
- Enclosing class:
- Utils
Mark a start time, and allow logging of elapsed time and time between log messages (steps of a process).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
log "message: elapsed xx ms"void
elapsedAndStep
(String message) log "message: step time xx ms, elapsed xx ms"static com.fishlib.io.log.LogLevel
Get (and possibly initialize) the default log level for Timers, configured byDEFAULT_LOG_LEVEL_PROP
com.fishlib.io.log.LogLevel
return the LogLevel configured for this timer.long
Get the elapsed time for the current step.static void
setDefaultLogLevel
(com.fishlib.io.log.LogLevel level) Set the static default log level for Timers.
-
Constructor Details
-
Timer
public Timer(@NotNull com.fishlib.io.logger.Logger log) -
Timer
public Timer(@NotNull com.fishlib.io.logger.Logger log, @NotNull com.fishlib.io.log.LogLevel level)
-
-
Method Details
-
getDefaultLogLevel
public static com.fishlib.io.log.LogLevel getDefaultLogLevel()Get (and possibly initialize) the default log level for Timers, configured byDEFAULT_LOG_LEVEL_PROP
- Returns:
- the default log level
-
setDefaultLogLevel
public static void setDefaultLogLevel(@NotNull com.fishlib.io.log.LogLevel level) Set the static default log level for Timers.- Parameters:
level
- the new default level
-
elapsed
log "message: elapsed xx ms"- Parameters:
message
- the message
-
elapsedAndStep
log "message: step time xx ms, elapsed xx ms"- Parameters:
message
- the message
-
getStepTime
public long getStepTime()Get the elapsed time for the current step.- Returns:
- now - markTime
-
getLogLevel
public com.fishlib.io.log.LogLevel getLogLevel()return the LogLevel configured for this timer.- Returns:
- the configured LogLevel
-