org.apache.dvsl
Class AntLogChute

java.lang.Object
  extended by org.apache.dvsl.AntLogChute
All Implemented Interfaces:
LogChute
Direct Known Subclasses:
AntLogSystem

public class AntLogChute
extends Object
implements LogChute

Implementation of a logger to output messages via an Ant Task's log method. Velocity log levels are mapped to corresponding log levels defined in Ant's logging API. The end result is messages will only be output if Ant log level is high enough.

Version:
$Id:$
Author:
Bill Burton

Field Summary
 
Fields inherited from interface org.apache.velocity.runtime.log.LogChute
DEBUG_ID, DEBUG_PREFIX, ERROR_ID, ERROR_PREFIX, INFO_ID, INFO_PREFIX, TRACE_ID, TRACE_PREFIX, WARN_ID, WARN_PREFIX
 
Constructor Summary
AntLogChute(Task task)
          Initialize this logger with a reference to the calling Ant Task
 
Method Summary
 void init(RuntimeServices rs)
          Initialize the logger.
 boolean isLevelEnabled(int level)
           
 void log(int level, String message)
           Log Velocity messages through the Ant Task log method.
 void log(int level, String message, Throwable throwable)
           Log throwables through the Ant Task log method.
 void logVelocityMessage(int level, String message)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AntLogChute

public AntLogChute(Task task)
Initialize this logger with a reference to the calling Ant Task

Parameters:
task - Ant Task to use for logging. This must not be null.
Method Detail

init

public void init(RuntimeServices rs)
          throws Exception
Initialize the logger.

Specified by:
init in interface LogChute
Throws:
Exception - if null was passed into the constructor

log

public void log(int level,
                String message)

Log Velocity messages through the Ant Task log method. The mapping of logging levels from Velocity to Ant is as follows:

 Velocity Level      -->  Ant Level
 LogSystem.TRACE_ID  -->  Project.MSG_DEBUG
 LogSystem.DEBUG_ID  -->  Project.MSG_DEBUG
 LogSystem.INFO_ID   -->  Project.MSG_VERBOSE
 LogSystem.WARN_ID   -->  Project.MSG_WARN
 LogSystem.ERROR_ID  -->  Project.MSG_ERR
 

Specified by:
log in interface LogChute
Parameters:
level - severity level
message - complete error message
See Also:
LogChute, org.apache.tools.ant.Task#log(String, int)

log

public void log(int level,
                String message,
                Throwable throwable)

Log throwables through the Ant Task log method. The mapping of logging levels from Velocity to Ant is as follows:

 Velocity Level      -->  Ant Level
 LogSystem.TRACE_ID  -->  Project.MSG_DEBUG
 LogSystem.DEBUG_ID  -->  Project.MSG_DEBUG
 LogSystem.INFO_ID   -->  Project.MSG_VERBOSE
 LogSystem.WARN_ID   -->  Project.MSG_WARN
 LogSystem.ERROR_ID  -->  Project.MSG_ERR
 

Specified by:
log in interface LogChute
Parameters:
level - severity level
message - complete error message
throwable - the throwable object to log
See Also:
LogChute, org.apache.tools.ant.Task#log(String, int)

isLevelEnabled

public boolean isLevelEnabled(int level)
Specified by:
isLevelEnabled in interface LogChute

logVelocityMessage

public void logVelocityMessage(int level,
                               String message)


Copyright © 2002-2007 The Apache Software Foundation. All Rights Reserved.