|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.aglets.log.console.ConsoleCategory
Logging object that writes all messages to stdout.
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 |
public ConsoleCategory(java.lang.String name)
name
- Name of category used as a prefix to the log messages.Method Detail |
public boolean isDebugEnabled()
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.
isDebugEnabled
in interface LogCategory
true
if this category is debug enabled,
false
otherwise.public void fatal(java.lang.Object msg)
fatal
in interface LogCategory
msg
- Message to be logged.public void error(java.lang.Object msg)
error
in interface LogCategory
msg
- Message to be logged.public void error(java.lang.Object msg, java.lang.Exception exc)
error
in interface LogCategory
msg
- Message to be logged.exc
- Description of Parameterpublic void warn(java.lang.Object msg)
warn
in interface LogCategory
msg
- Message to be logged.public void info(java.lang.Object msg)
info
in interface LogCategory
msg
- Message to be logged.public void debug(java.lang.Object msg)
debug
in interface LogCategory
msg
- Message to be logged.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |