org.aglets.log.console
Class ConsoleCategory

java.lang.Object
  |
  +--org.aglets.log.console.ConsoleCategory
All Implemented Interfaces:
LogCategory

public class ConsoleCategory
extends java.lang.Object
implements LogCategory

Logging object that writes all messages to stdout.

Since:
 
Version:
$Revision: 1.1.1.1 $ $Date: 2001/07/28 06:34:40 $ $Author: kbd4hire $
Author:
Robert Bergstrom

Constructor Summary
ConsoleCategory(java.lang.String name)
          Constructor
 
Method Summary
 void debug(java.lang.Object msg)
          Logs a message at debug priority.
 void error(java.lang.Object msg)
          Logs a message at error priority.
 void error(java.lang.Object msg, java.lang.Exception exc)
          Logs a message at error priority and passes an exception for logging.
 void fatal(java.lang.Object msg)
          Logs a message at fatal priority.
 void info(java.lang.Object msg)
          Logs a mesasge at info priority.
 boolean isDebugEnabled()
          Check whether this category is enabled for the DEBUG priority.
 void warn(java.lang.Object msg)
          Logs a message at warn priority.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConsoleCategory

public ConsoleCategory(java.lang.String name)
Constructor
Parameters:
name - Name of category used as a prefix to the log messages.
Method Detail

isDebugEnabled

public boolean isDebugEnabled()
Check whether this category is enabled for the DEBUG priority.

This function is intended to lessen the computational cost of disabled log debug statements.

For some cat Category object, when you write,


  cat.debug("This is entry number: " + i );

You incur the cost constructing the message, concatenatiion in this case, regardless of whether the message is logged or not.

If you are worried about speed, then you should write


  if(cat.isDebugEnabled()) { cat.debug("This is entry number: " + i ); }
  

This way you will not incur the cost of parameter construction if debugging is disabled for cat . On the other hand, if the cat is debug enabled, you will incur the cost of evaluating whether the category is debug enabled twice. Once in isDebugEnabled and once in the debug . This is an insignificant overhead since evaluating a category takes about 1%% of the time it takes to actually log.

Specified by:
isDebugEnabled in interface LogCategory
Returns:
boolean - true if this category is debug enabled, false otherwise.
Since:
 

fatal

public void fatal(java.lang.Object msg)
Logs a message at fatal priority.
Specified by:
fatal in interface LogCategory
Parameters:
msg - Message to be logged.
Since:
1.0

error

public void error(java.lang.Object msg)
Logs a message at error priority.
Specified by:
error in interface LogCategory
Parameters:
msg - Message to be logged.
Since:
1.0

error

public void error(java.lang.Object msg,
                  java.lang.Exception exc)
Logs a message at error priority and passes an exception for logging.
Specified by:
error in interface LogCategory
Parameters:
msg - Message to be logged.
exc - Description of Parameter
Since:
1.0

warn

public void warn(java.lang.Object msg)
Logs a message at warn priority.
Specified by:
warn in interface LogCategory
Parameters:
msg - Message to be logged.
Since:
1.0

info

public void info(java.lang.Object msg)
Logs a mesasge at info priority.
Specified by:
info in interface LogCategory
Parameters:
msg - Message to be logged.
Since:
1.0

debug

public void debug(java.lang.Object msg)
Logs a message at debug priority.
Specified by:
debug in interface LogCategory
Parameters:
msg - Message to be logged.
Since:
1.0