| java.lang.Object org.apache.tools.ant.DefaultLogger
All known Subclasses: org.apache.tools.ant.listener.TimestampedLogger, org.apache.tools.ant.listener.MailLogger, org.apache.tools.ant.NoBannerLogger, org.apache.tools.ant.listener.AnsiColorLogger,
DefaultLogger | public class DefaultLogger implements BuildLogger(Code) | | Writes build events to a PrintStream. Currently, it
only writes which targets are being executed, and
any messages that get logged.
|
Method Summary | |
public void | buildFinished(BuildEvent event) Prints whether the build succeeded or failed,
any errors the occurred during the build, and
how long the build took. | public void | buildStarted(BuildEvent event) Responds to a build being started by just remembering the current time. | protected static String | formatTime(long millis) Convenience method to format a specified length of time.
Parameters: millis - Length of time to format, in milliseconds. | protected String | getBuildFailedMessage() This is an override point: the message that indicates whether a build failed. | protected String | getBuildSuccessfulMessage() This is an override point: the message that indicates that a build succeeded. | protected void | log(String message) Empty implementation which allows subclasses to receive the
same output that is generated here.
Parameters: message - Message being logged. | public void | messageLogged(BuildEvent event) Logs a message, if the priority is suitable. | protected void | printMessage(String message, PrintStream stream, int priority) Prints a message to a PrintStream. | public void | setEmacsMode(boolean emacsMode) Sets this logger to produce emacs (and other editor) friendly output. | public void | setErrorPrintStream(PrintStream err) Sets the output stream to which this logger is to send error messages. | public void | setMessageOutputLevel(int level) Sets the highest level of message this logger should respond to.
Only messages with a message level lower than or equal to the
given level should be written to the log.
Constants for the message levels are in the
Project Project class. | public void | setOutputPrintStream(PrintStream output) Sets the output stream to which this logger is to send its output. | public void | targetFinished(BuildEvent event) No-op implementation. | public void | targetStarted(BuildEvent event) Logs a message to say that the target has started if this
logger allows information-level messages. | public void | taskFinished(BuildEvent event) No-op implementation. | public void | taskStarted(BuildEvent event) No-op implementation. |
emacsMode | protected boolean emacsMode(Code) | | Whether or not to use emacs-style output
|
msgOutputLevel | protected int msgOutputLevel(Code) | | Lowest level of message to write out
|
DefaultLogger | public DefaultLogger()(Code) | | Sole constructor.
|
buildFinished | public void buildFinished(BuildEvent event)(Code) | | Prints whether the build succeeded or failed,
any errors the occurred during the build, and
how long the build took.
Parameters: event - An event with any relevant extra information.Must not be null . |
buildStarted | public void buildStarted(BuildEvent event)(Code) | | Responds to a build being started by just remembering the current time.
Parameters: event - Ignored. |
formatTime | protected static String formatTime(long millis)(Code) | | Convenience method to format a specified length of time.
Parameters: millis - Length of time to format, in milliseconds. the time as a formatted string. See Also: DateUtils.formatElapsedTime(long) |
getBuildFailedMessage | protected String getBuildFailedMessage()(Code) | | This is an override point: the message that indicates whether a build failed.
Subclasses can change/enhance the message.
The classic "BUILD FAILED" |
getBuildSuccessfulMessage | protected String getBuildSuccessfulMessage()(Code) | | This is an override point: the message that indicates that a build succeeded.
Subclasses can change/enhance the message.
The classic "BUILD SUCCESSFUL" |
log | protected void log(String message)(Code) | | Empty implementation which allows subclasses to receive the
same output that is generated here.
Parameters: message - Message being logged. Should not be null . |
messageLogged | public void messageLogged(BuildEvent event)(Code) | | Logs a message, if the priority is suitable.
In non-emacs mode, task level messages are prefixed by the
task name which is right-justified.
Parameters: event - A BuildEvent containing message information.Must not be null . |
printMessage | protected void printMessage(String message, PrintStream stream, int priority)(Code) | | Prints a message to a PrintStream.
Parameters: message - The message to print.Should not be null . Parameters: stream - A PrintStream to print the message to.Must not be null . Parameters: priority - The priority of the message.(Ignored in this implementation.) |
setEmacsMode | public void setEmacsMode(boolean emacsMode)(Code) | | Sets this logger to produce emacs (and other editor) friendly output.
Parameters: emacsMode - true if output is to be unadorned so thatemacs and other editors can parse files names, etc. |
setErrorPrintStream | public void setErrorPrintStream(PrintStream err)(Code) | | Sets the output stream to which this logger is to send error messages.
Parameters: err - The error stream for the logger.Must not be null . |
setMessageOutputLevel | public void setMessageOutputLevel(int level)(Code) | | Sets the highest level of message this logger should respond to.
Only messages with a message level lower than or equal to the
given level should be written to the log.
Constants for the message levels are in the
Project Project class. The order of the levels, from least
to most verbose, is MSG_ERR , MSG_WARN ,
MSG_INFO , MSG_VERBOSE ,
MSG_DEBUG .
The default message level for DefaultLogger is Project.MSG_ERR.
Parameters: level - the logging level for the logger. |
setOutputPrintStream | public void setOutputPrintStream(PrintStream output)(Code) | | Sets the output stream to which this logger is to send its output.
Parameters: output - The output stream for the logger.Must not be null . |
targetFinished | public void targetFinished(BuildEvent event)(Code) | | No-op implementation.
Parameters: event - Ignored. |
targetStarted | public void targetStarted(BuildEvent event)(Code) | | Logs a message to say that the target has started if this
logger allows information-level messages.
Parameters: event - An event with any relevant extra information.Must not be null . |
taskFinished | public void taskFinished(BuildEvent event)(Code) | | No-op implementation.
Parameters: event - Ignored. |
taskStarted | public void taskStarted(BuildEvent event)(Code) | | No-op implementation.
Parameters: event - Ignored. |
|
|