com.objectwave.logging
Class ConsoleImpl

java.lang.Object
  |
  +--com.objectwave.logging.ConsoleImpl
All Implemented Interfaces:
LogIF

public class ConsoleImpl
extends java.lang.Object
implements LogIF

Display logging information to the System.out stream.

Version:
$Id: ConsoleImpl.java,v 2.6 2002/07/31 15:55:22 dave_hoag Exp $
Author:
Dave Hoag

Nested Class Summary
static class ConsoleImpl.Test
           
 
Field Summary
protected static java.text.DateFormat dateFormat
           
protected  boolean debugOn
           
protected static java.lang.ThreadLocal traceHolder
           
 
Constructor Summary
ConsoleImpl()
           
 
Method Summary
 void debug(java.lang.Object source, java.lang.String message)
          Dump text to string with a priority of debug.
 void debug(java.lang.Object source, java.lang.String message, java.lang.Throwable cause)
          Dump text to string with a priority of debug.
 void error(java.lang.Object source, java.lang.String message, java.lang.Throwable cause)
          Dump text to string with a priority of error.
protected  java.lang.String formatCategory(java.lang.String text)
          Decorate the text with any tracing information.
protected  java.lang.String formatMessage(java.lang.String text)
           
protected  java.lang.String getCategoryId(java.lang.Object source)
          Categories are identified by the package name of the object.
 void info(java.lang.Object source, java.lang.String message)
          Dump text to string with a priority of info.
 boolean isDebugEnabled(java.lang.Object source)
          isDebugEnabled for the given source.
static void setDateFormat(java.text.DateFormat format)
          Allow the customization of the date format.
 void setDebugEnabled(java.lang.Object source, boolean value)
          Allow the debug output to be disabled.
 void track(java.lang.String categoryName, Trace codeBlock)
          Run the provided code block and decorate any resulting log messages with specified category.
 void warn(java.lang.Object source, java.lang.String message)
          Dump text to string with a priority of warn.
 void warn(java.lang.Object source, java.lang.String message, java.lang.Throwable cause)
          Dump text to string with a priority of warn.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

traceHolder

protected static java.lang.ThreadLocal traceHolder

dateFormat

protected static java.text.DateFormat dateFormat

debugOn

protected boolean debugOn
Constructor Detail

ConsoleImpl

public ConsoleImpl()
Method Detail

setDateFormat

public static void setDateFormat(java.text.DateFormat format)
Allow the customization of the date format.

Parameters:
format - The new DateFormat value

setDebugEnabled

public void setDebugEnabled(java.lang.Object source,
                            boolean value)
Allow the debug output to be disabled.

Parameters:
source - The new DebugEnabled value
value - The new DebugEnabled value

isDebugEnabled

public boolean isDebugEnabled(java.lang.Object source)
isDebugEnabled for the given source.

Specified by:
isDebugEnabled in interface LogIF
Parameters:
source - Source will resolve to a category - not used right now.
Returns:
True if debug logging is enabled.

getCategoryId

protected java.lang.String getCategoryId(java.lang.Object source)
Categories are identified by the package name of the object.

Parameters:
source - An object that is requesting this log to be generated.
Returns:
The CategoryId value

formatMessage

protected java.lang.String formatMessage(java.lang.String text)
Parameters:
text -
Returns:

track

public void track(java.lang.String categoryName,
                  Trace codeBlock)
           throws java.lang.Exception
Run the provided code block and decorate any resulting log messages with specified category.

Specified by:
track in interface LogIF
Parameters:
categoryName -
codeBlock -
Throws:
java.lang.Exception

info

public void info(java.lang.Object source,
                 java.lang.String message)
Dump text to string with a priority of info.

Specified by:
info in interface LogIF
Parameters:
source - Source will resolve to a category id.
message - The text to display.

warn

public void warn(java.lang.Object source,
                 java.lang.String message)
Dump text to string with a priority of warn.

Specified by:
warn in interface LogIF
Parameters:
source - Source will resolve to a category id.
message - The text to display.

warn

public void warn(java.lang.Object source,
                 java.lang.String message,
                 java.lang.Throwable cause)
Dump text to string with a priority of warn.

Specified by:
warn in interface LogIF
Parameters:
source - Source will resolve to a category id.
message - The text to display.
cause -

debug

public void debug(java.lang.Object source,
                  java.lang.String message)
Dump text to string with a priority of debug.

Specified by:
debug in interface LogIF
Parameters:
source - Source will resolve to a category id.
message - The text to display.

debug

public void debug(java.lang.Object source,
                  java.lang.String message,
                  java.lang.Throwable cause)
Dump text to string with a priority of debug. Also print the stack trace.

Specified by:
debug in interface LogIF
Parameters:
source - Source will resolve to a category id.
message - The text to display.
cause - Description of Parameter

error

public void error(java.lang.Object source,
                  java.lang.String message,
                  java.lang.Throwable cause)
Dump text to string with a priority of error.

Specified by:
error in interface LogIF
Parameters:
source - Source will resolve to a category id.
message - The text to display.
cause - Description of Parameter

formatCategory

protected java.lang.String formatCategory(java.lang.String text)
Decorate the text with any tracing information.

Parameters:
text -
Returns: