public final class AntEvent extends Object
AntLogger
.
Note that one event is shared across all listeners.
The information available from the event represents a best effort to gather information from the Ant run. Some versions of Ant may not support all of these capabilities, in which case the event method will simply return null or whatever the documented fallback value is. For example, Ant 1.5 does not permit details of task structure to be introspected, but 1.6 does.
Modifier and Type | Field and Description |
---|---|
static int |
LOG_DEBUG
Debugging log level.
|
static int |
LOG_ERR
Error log level.
|
static int |
LOG_INFO
Information log level.
|
static int |
LOG_VERBOSE
Verbose log level.
|
static int |
LOG_WARN
Warning log level.
|
Modifier and Type | Method and Description |
---|---|
void |
consume()
Mark an event as consumed to advise other loggers not to handle it.
|
String |
evaluate(String text)
Evaluate a string with possible substitutions according to defined properties.
|
Throwable |
getException()
Get a terminating exception.
|
int |
getLine()
Get the line number in
AntEvent.getScriptLocation() corresponding to this event. |
int |
getLogLevel()
Get the log level of the message.
|
String |
getMessage()
Get the name of the message being logged.
|
String |
getProperty(String name)
Get a property set on the current Ant project.
|
Set<String> |
getPropertyNames()
Get a set of property names defined on the current Ant project.
|
File |
getScriptLocation()
Get the location of the Ant script producing this event.
|
AntSession |
getSession()
Get the associated session.
|
String |
getTargetName()
Get the name of the target in
AntEvent.getScriptLocation() producing this event. |
String |
getTaskName()
Get the name of the task producing this event.
|
TaskStructure |
getTaskStructure()
Get the configured XML structure of the task producing this event.
|
boolean |
isConsumed()
Test whether this event has already been consumed by some other logger.
|
String |
toString() |
public static final int LOG_ERR
public static final int LOG_WARN
public static final int LOG_INFO
public static final int LOG_VERBOSE
public static final int LOG_DEBUG
public AntSession getSession()
public void consume() throws IllegalStateException
IllegalStateException
- if it was already consumedpublic boolean isConsumed()
public File getScriptLocation()
public int getLine()
AntEvent.getScriptLocation()
corresponding to this event.
Line numbers start at one.public String getTargetName()
AntEvent.getScriptLocation()
producing this event.
Some events occur outside targets and so there will be no target name.public String getTaskName()
public TaskStructure getTaskStructure()
public String getMessage()
AntLogger.messageLogged(org.apache.tools.ant.module.spi.AntEvent)
.public int getLogLevel()
AntLogger.messageLogged(org.apache.tools.ant.module.spi.AntEvent)
.
Note that lower numbers are higher priority.public Throwable getException()
AntLogger.buildFinished(org.apache.tools.ant.module.spi.AntEvent)
and AntLogger.buildInitializationFailed(org.apache.tools.ant.module.spi.AntEvent)
.public String getProperty(String name)
name
- the property namepublic Set<String> getPropertyNames()
public String evaluate(String text)
text
- the text to evaluateTaskStructure.getAttribute(java.lang.String)
,
TaskStructure.getText()