org.codehaus.dna.impl
Class ConsoleLogger

java.lang.Object
  extended byorg.codehaus.dna.impl.ConsoleLogger
All Implemented Interfaces:
Logger

public class ConsoleLogger
extends java.lang.Object
implements Logger

A simple logger facade that simply writes to the Console.

Version:
$Revision: 1.2 $ $Date: 2004/05/01 09:51:48 $

Field Summary
static int LEVEL_ALL
          Constant to indicate that the logger must log all levels.
static int LEVEL_DEBUG
          Constant to indicate that the logger must log all levels DEBUG and above.
static int LEVEL_ERROR
          Constant to indicate that the logger must log all levels ERROR and above.
static int LEVEL_INFO
          Constant to indicate that the logger must log all levels INFO and above.
static int LEVEL_NONE
          Constant to indicate that the logger must not log any messages.
static int LEVEL_TRACE
          Constant to indicate that the logger must log all levels TRACE and above.
static int LEVEL_WARN
          Constant to indicate that the logger must log all levels WARN and above.
 
Constructor Summary
ConsoleLogger()
          Create a Console Logger that logs all messages.
ConsoleLogger(int level)
          Create a Console Logger that logs at specified level.
ConsoleLogger(int level, java.io.PrintStream output)
          Create a Console Logger that logs at specified level.
 
Method Summary
 void debug(java.lang.String message)
          Log a debug message.
 void debug(java.lang.String message, java.lang.Throwable throwable)
          Log a debug message with an associated throwable.
 void error(java.lang.String message)
          Log a error message.
 void error(java.lang.String message, java.lang.Throwable throwable)
          Log a error message with an associated throwable.
 Logger getChildLogger(java.lang.String name)
          Get the child logger with specified name.
 void info(java.lang.String message)
          Log a info message.
 void info(java.lang.String message, java.lang.Throwable throwable)
          Log a info message with an associated throwable.
 boolean isDebugEnabled()
          Return true if a debug message will be logged.
 boolean isErrorEnabled()
          Return true if a error message will be logged.
 boolean isInfoEnabled()
          Return true if an info message will be logged.
 boolean isTraceEnabled()
          Return true if a trace message will be logged.
 boolean isWarnEnabled()
          Return true if a warn message will be logged.
 void trace(java.lang.String message)
          Log a trace message.
 void trace(java.lang.String message, java.lang.Throwable throwable)
          Log a trace message with an associated throwable.
 void warn(java.lang.String message)
          Log a warn message.
 void warn(java.lang.String message, java.lang.Throwable throwable)
          Log a warn message with an associated throwable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LEVEL_ALL

public static final int LEVEL_ALL
Constant to indicate that the logger must log all levels.

See Also:
Constant Field Values

LEVEL_TRACE

public static final int LEVEL_TRACE
Constant to indicate that the logger must log all levels TRACE and above.

See Also:
Constant Field Values

LEVEL_DEBUG

public static final int LEVEL_DEBUG
Constant to indicate that the logger must log all levels DEBUG and above.

See Also:
Constant Field Values

LEVEL_INFO

public static final int LEVEL_INFO
Constant to indicate that the logger must log all levels INFO and above.

See Also:
Constant Field Values

LEVEL_WARN

public static final int LEVEL_WARN
Constant to indicate that the logger must log all levels WARN and above.

See Also:
Constant Field Values

LEVEL_ERROR

public static final int LEVEL_ERROR
Constant to indicate that the logger must log all levels ERROR and above.

See Also:
Constant Field Values

LEVEL_NONE

public static final int LEVEL_NONE
Constant to indicate that the logger must not log any messages.

See Also:
Constant Field Values
Constructor Detail

ConsoleLogger

public ConsoleLogger()
Create a Console Logger that logs all messages.


ConsoleLogger

public ConsoleLogger(int level)
Create a Console Logger that logs at specified level.

Parameters:
level - one of the LEVEL_* constants

ConsoleLogger

public ConsoleLogger(int level,
                     java.io.PrintStream output)
Create a Console Logger that logs at specified level.

Parameters:
level - one of the LEVEL_* constants
output - the stream to output to
Method Detail

trace

public void trace(java.lang.String message)
Log a trace message.

Specified by:
trace in interface Logger
Parameters:
message - the message

trace

public void trace(java.lang.String message,
                  java.lang.Throwable throwable)
Log a trace message with an associated throwable.

Specified by:
trace in interface Logger
Parameters:
message - the message
throwable - the throwable

isTraceEnabled

public boolean isTraceEnabled()
Return true if a trace message will be logged.

Specified by:
isTraceEnabled in interface Logger
Returns:
true if message will be logged

debug

public void debug(java.lang.String message)
Log a debug message.

Specified by:
debug in interface Logger
Parameters:
message - the message

debug

public void debug(java.lang.String message,
                  java.lang.Throwable throwable)
Log a debug message with an associated throwable.

Specified by:
debug in interface Logger
Parameters:
message - the message
throwable - the throwable

isDebugEnabled

public boolean isDebugEnabled()
Return true if a debug message will be logged.

Specified by:
isDebugEnabled in interface Logger
Returns:
true if message will be logged

info

public void info(java.lang.String message)
Log a info message.

Specified by:
info in interface Logger
Parameters:
message - the message

info

public void info(java.lang.String message,
                 java.lang.Throwable throwable)
Log a info message with an associated throwable.

Specified by:
info in interface Logger
Parameters:
message - the message
throwable - the throwable

isInfoEnabled

public boolean isInfoEnabled()
Return true if an info message will be logged.

Specified by:
isInfoEnabled in interface Logger
Returns:
true if message will be logged

warn

public void warn(java.lang.String message)
Log a warn message.

Specified by:
warn in interface Logger
Parameters:
message - the message

warn

public void warn(java.lang.String message,
                 java.lang.Throwable throwable)
Log a warn message with an associated throwable.

Specified by:
warn in interface Logger
Parameters:
message - the message
throwable - the throwable

isWarnEnabled

public boolean isWarnEnabled()
Return true if a warn message will be logged.

Specified by:
isWarnEnabled in interface Logger
Returns:
true if message will be logged

error

public void error(java.lang.String message)
Log a error message.

Specified by:
error in interface Logger
Parameters:
message - the message

error

public void error(java.lang.String message,
                  java.lang.Throwable throwable)
Log a error message with an associated throwable.

Specified by:
error in interface Logger
Parameters:
message - the message
throwable - the throwable

isErrorEnabled

public boolean isErrorEnabled()
Return true if a error message will be logged.

Specified by:
isErrorEnabled in interface Logger
Returns:
true if message will be logged

getChildLogger

public Logger getChildLogger(java.lang.String name)
Get the child logger with specified name.

Specified by:
getChildLogger in interface Logger
Parameters:
name - the name of child logger
Returns:
the child logger


Copyright © 2003-2004 Codehaus. All Rights Reserved.