com.ecyrd.speed4j.log
Class Log

java.lang.Object
  extended by com.ecyrd.speed4j.log.Log
Direct Known Subclasses:
Slf4jLog

public abstract class Log
extends Object

Base class for the Logs. A Log is an abstract entity that encapsulates the knowledge how to manage the information contained by StopWatches upon their stop() method.


Constructor Summary
Log()
           
 
Method Summary
 String getName()
          Returns the name of the Log.
 boolean isEnabled()
          Returns true, if this Log is enabled.
abstract  void log(StopWatch sw)
          Logs the given StopWatch.
 void setEnable(boolean value)
          Enable or disable this Log.
 void setName(String name)
          Sets the name of the Log.
 void shutdown()
          Shuts the Log down.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Log

public Log()
Method Detail

setEnable

public void setEnable(boolean value)
Enable or disable this Log. If the log is disabled, no logging is done until it is enabled again. By default, the Log is enabled when it's created (though obviously, some subclasses might make start disabled).

Parameters:
value - True, if enabled. False otherwise.

isEnabled

public boolean isEnabled()
Returns true, if this Log is enabled.

Returns:
True or false.

setName

public void setName(String name)
Sets the name of the Log. If not set, uses .

Parameters:
name - Name of the Log.

getName

public String getName()
Returns the name of the Log.

Returns:
The name of the Log.

log

public abstract void log(StopWatch sw)
Logs the given StopWatch. Called when stop() is called. In general, you will want to keep this method fairly speedy, since StopWatches are often used inside tight loops.

Parameters:
sw - The StopWatch to log.

shutdown

public void shutdown()
Shuts the Log down. This can be used to free resources, etc.



Copyright © 2011. All Rights Reserved.