/** * @return true whether the provided appender has DEBUG enabled and therefore asked to track * times. */ public boolean isEnabled() { return getLogger().isDebugEnabled(); } }
/** * track the time and stop the clock. * * @param message */ public void stop(@Nullable final String message) { track(this, message); clock = null; }
/** * convenience method for tracking the messages * * @param customLog a potential custom logger. If null the static instance will be used * @param clock the clock used for tracking. * @param clazz the class to be used during the tracking of times * @param message a custom message for the tracking. */ private static void track(@NotNull final StopwatchLogger swl, @Nullable final String message) { checkNotNull(swl); if (swl.isEnabled()) { Logger l = swl.getLogger(); if (swl.clock == null) { l.debug("{} - clock has not been started yet.", swl.clazz); } else { Clock c = swl.clock; l.debug( "{} - {} {}ms", new Object[] { checkNotNull(swl.clazz), message == null ? "" : message, c.getTimeMonotonic() - swl.start}); } } }
/** * convenience method for tracking the messages * * @param customLog a potential custom logger. If null the static instance will be used * @param clock the clock used for tracking. * @param clazz the class to be used during the tracking of times * @param message a custom message for the tracking. */ private static void track(@Nonnull final StopwatchLogger swl, @Nullable final String message) { checkNotNull(swl); if (swl.isEnabled()) { Logger l = swl.getLogger(); if (swl.clock == null) { l.debug("{} - clock has not been started yet.", swl.clazz); } else { Clock c = swl.clock; l.debug( "{} - {} {}ms", new Object[] { checkNotNull(swl.clazz), message == null ? "" : message, c.getTimeMonotonic() - swl.start}); } } }
/** * track of an intermediate time without stopping the ticking. * * @param message */ public void split(@Nullable final String message) { track(this, message); }
/** * @return true whether the provided appender has DEBUG enabled and therefore asked to track * times. */ public boolean isEnabled() { return getLogger().isDebugEnabled(); } }
/** * track of an intermediate time without stopping the ticking. * * @param message */ public void split(@Nullable final String message) { track(this, message); }
/** * track the time and stop the clock. * * @param message */ public void stop(@Nullable final String message) { track(this, message); clock = null; }