net.sf.seam.perf4j
Class SeamLoggerStopWatch

java.lang.Object
  extended by org.perf4j.StopWatch
      extended by org.perf4j.LoggingStopWatch
          extended by net.sf.seam.perf4j.SeamLoggerStopWatch
All Implemented Interfaces:
Serializable, Cloneable

public class SeamLoggerStopWatch
extends LoggingStopWatch

An implementation of Perf4j's LoggingStopWatch using Seam Logger to log messages.

Author:
Marcin ZajÄ…czkowski, 2010-01-30
See Also:
Serialized Form

Nested Class Summary
static class SeamLoggerStopWatch.LoggingLevel
          Levels (priorites) to log messages on.
 
Field Summary
static SeamLoggerStopWatch.LoggingLevel DEFAULT_EXCEPTION_PRIORITY
           
static SeamLoggerStopWatch.LoggingLevel DEFAULT_NORMAL_PRIORITY
           
 
Fields inherited from class org.perf4j.StopWatch
DEFAULT_LOGGER_NAME
 
Constructor Summary
SeamLoggerStopWatch()
          Default constructor.
SeamLoggerStopWatch(org.jboss.seam.log.Log logger)
           
SeamLoggerStopWatch(org.jboss.seam.log.Log logger, SeamLoggerStopWatch.LoggingLevel normalPriority)
           
SeamLoggerStopWatch(org.jboss.seam.log.Log logger, SeamLoggerStopWatch.LoggingLevel normalPriority, SeamLoggerStopWatch.LoggingLevel exceptionPriority)
          Constructs StopWatch with given logger and given logging levels (priorities).
SeamLoggerStopWatch(org.jboss.seam.log.Log logger, String normalPriority)
           
SeamLoggerStopWatch(org.jboss.seam.log.Log logger, String normalPriority, String exceptionPriority)
           
SeamLoggerStopWatch(SeamLoggerStopWatch.LoggingLevel normalPriority)
           
SeamLoggerStopWatch(SeamLoggerStopWatch.LoggingLevel normalPriority, SeamLoggerStopWatch.LoggingLevel exceptionPriority)
           
SeamLoggerStopWatch(String normalPriority)
           
SeamLoggerStopWatch(String normalPriority, String exceptionPriority)
           
 
Method Summary
 SeamLoggerStopWatch.LoggingLevel getExceptionPriority()
           
 org.jboss.seam.log.Log getLogger()
           
 SeamLoggerStopWatch.LoggingLevel getNormalPriority()
           
 boolean isLogging()
          Determines if logging is currently enabled for normal log messages printed by StopWatch.
protected  void log(String stopWatchAsString, Throwable exception)
          Logs StopWatch message using Seam's logger.
 
Methods inherited from class org.perf4j.LoggingStopWatch
clone, getTimeThreshold, lap, lap, setMessage, setTag, setTimeThreshold, stop, stop, stop, stop
 
Methods inherited from class org.perf4j.StopWatch
equals, getElapsedTime, getMessage, getStartTime, getTag, hashCode, lap, lap, start, start, start, stop, stop, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_NORMAL_PRIORITY

public static final SeamLoggerStopWatch.LoggingLevel DEFAULT_NORMAL_PRIORITY

DEFAULT_EXCEPTION_PRIORITY

public static final SeamLoggerStopWatch.LoggingLevel DEFAULT_EXCEPTION_PRIORITY
Constructor Detail

SeamLoggerStopWatch

public SeamLoggerStopWatch()
Default constructor.


SeamLoggerStopWatch

public SeamLoggerStopWatch(SeamLoggerStopWatch.LoggingLevel normalPriority)

SeamLoggerStopWatch

public SeamLoggerStopWatch(SeamLoggerStopWatch.LoggingLevel normalPriority,
                           SeamLoggerStopWatch.LoggingLevel exceptionPriority)

SeamLoggerStopWatch

public SeamLoggerStopWatch(String normalPriority)

SeamLoggerStopWatch

public SeamLoggerStopWatch(String normalPriority,
                           String exceptionPriority)

SeamLoggerStopWatch

public SeamLoggerStopWatch(org.jboss.seam.log.Log logger)

SeamLoggerStopWatch

public SeamLoggerStopWatch(org.jboss.seam.log.Log logger,
                           String normalPriority)

SeamLoggerStopWatch

public SeamLoggerStopWatch(org.jboss.seam.log.Log logger,
                           String normalPriority,
                           String exceptionPriority)

SeamLoggerStopWatch

public SeamLoggerStopWatch(org.jboss.seam.log.Log logger,
                           SeamLoggerStopWatch.LoggingLevel normalPriority)

SeamLoggerStopWatch

public SeamLoggerStopWatch(org.jboss.seam.log.Log logger,
                           SeamLoggerStopWatch.LoggingLevel normalPriority,
                           SeamLoggerStopWatch.LoggingLevel exceptionPriority)
Constructs StopWatch with given logger and given logging levels (priorities).

Parameters:
logger - logger to use
normalPriority - default logging level to use
exceptionPriority - logging level to use when exception occurred
Method Detail

getLogger

public org.jboss.seam.log.Log getLogger()

getNormalPriority

public SeamLoggerStopWatch.LoggingLevel getNormalPriority()

getExceptionPriority

public SeamLoggerStopWatch.LoggingLevel getExceptionPriority()

isLogging

public boolean isLogging()
Determines if logging is currently enabled for normal log messages printed by StopWatch. In implementation isXXXEnabled() from org.jboss.seam.log.Log interface is used.

Overrides:
isLogging in class LoggingStopWatch
Returns:
true if calls of stop() method that do not take an exception will be logged using logger

log

protected void log(String stopWatchAsString,
                   Throwable exception)
Logs StopWatch message using Seam's logger.

Overrides:
log in class LoggingStopWatch
Parameters:
stopWatchAsString - serialized StopWatch string
exception - optional exception passed to be logged


Copyright © 2010. All Rights Reserved.