org.apache.tools.dvsl
Class AntLogSystem

java.lang.Object
  extended byorg.apache.tools.dvsl.AntLogSystem
All Implemented Interfaces:
org.apache.velocity.runtime.log.LogSystem

public class AntLogSystem
extends java.lang.Object
implements org.apache.velocity.runtime.log.LogSystem

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: AntLogSystem.java,v 1.1 2002/02/22 06:07:01 geirm Exp $
Author:
Bill Burton

Field Summary
(package private)  org.apache.tools.ant.Task task
           
 
Fields inherited from interface org.apache.velocity.runtime.log.LogSystem
DEBUG_ID, DEBUG_ON, ERROR_ID, INFO_ID, WARN_ID
 
Constructor Summary
AntLogSystem(org.apache.tools.ant.Task task)
          Initialize this logger with a reference to the calling Ant Task
 
Method Summary
 void init(org.apache.velocity.runtime.RuntimeServices rs)
          Initialize the logger.
 void logVelocityMessage(int level, java.lang.String message)
           Log Velocity messages through the Ant Task log method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

task

org.apache.tools.ant.Task task
Constructor Detail

AntLogSystem

public AntLogSystem(org.apache.tools.ant.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(org.apache.velocity.runtime.RuntimeServices rs)
          throws java.lang.Exception
Initialize the logger.

Specified by:
init in interface org.apache.velocity.runtime.log.LogSystem
Throws:
java.lang.Exception - if null was passed into the constructor

logVelocityMessage

public void logVelocityMessage(int level,
                               java.lang.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.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:
logVelocityMessage in interface org.apache.velocity.runtime.log.LogSystem
Parameters:
level - severity level
message - complete error message
See Also:
LogSystem, Task.log(String, int)


Copyright (c) 2001-2002 Apache Software Foundation