org.apache.tools.ant
public class DefaultLogger extends Object implements BuildLogger
| Field Summary | |
|---|---|
| protected boolean | emacsMode Whether or not to use emacs-style output |
| protected PrintStream | err PrintStream to write error messages to |
| protected static String | lSep Line separator |
| static int | LEFT_COLUMN_SIZE
Size of left-hand column for right-justified task name. |
| protected int | msgOutputLevel Lowest level of message to write out |
| protected PrintStream | out PrintStream to write non-error messages to |
| Constructor Summary | |
|---|---|
| DefaultLogger()
Sole constructor. | |
| Method Summary | |
|---|---|
| void | buildFinished(BuildEvent event)
Prints whether the build succeeded or failed,
any errors the occurred during the build, and
how long the build took.
|
| void | buildStarted(BuildEvent event)
Responds to a build being started by just remembering the current time.
|
| protected String | extractProjectName(BuildEvent event)
Get the project name or null |
| protected static String | formatTime(long millis)
Convenience method to format a specified length of time.
|
| 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 String | getTimestamp()
Get the current time. |
| protected void | log(String message)
Empty implementation which allows subclasses to receive the
same output that is generated here.
|
| 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.
|
| void | setEmacsMode(boolean emacsMode)
Sets this logger to produce emacs (and other editor) friendly output.
|
| void | setErrorPrintStream(PrintStream err)
Sets the output stream to which this logger is to send error messages.
|
| void | setMessageOutputLevel(int level)
Sets the highest level of message this logger should respond to.
|
| void | setOutputPrintStream(PrintStream output)
Sets the output stream to which this logger is to send its output.
|
| void | targetFinished(BuildEvent event)
No-op implementation.
|
| void | targetStarted(BuildEvent event)
Logs a message to say that the target has started if this
logger allows information-level messages.
|
| void | taskFinished(BuildEvent event)
No-op implementation.
|
| void | taskStarted(BuildEvent event)
No-op implementation.
|
See Also: messageLogged
Parameters: event An event with any relevant extra information.
Must not be null.
Parameters: event Ignored.
Parameters: event the event
Returns: the project that raised this event
Since: Ant1.7.1
Parameters: millis Length of time to format, in milliseconds.
Returns: the time as a formatted string.
See Also: DateUtils
Returns: The classic "BUILD FAILED"
Returns: The classic "BUILD SUCCESSFUL"
Returns: the current time as a formatted string.
Since: Ant1.7.1
Parameters: message Message being logged. Should not be null.
Parameters: event A BuildEvent containing message information.
Must not be null.
Parameters: message The message to print.
Should not be null. stream A PrintStream to print the message to.
Must not be null. priority The priority of the message.
(Ignored in this implementation.)
Parameters: emacsMode true if output is to be unadorned so that
emacs and other editors can parse files names, etc.
Parameters: err The error stream for the logger.
Must not be null.
Constants for the message levels are in the
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.
Parameters: output The output stream for the logger.
Must not be null.
Parameters: event Ignored.
Parameters: event An event with any relevant extra information.
Must not be null.
Parameters: event Ignored.
Parameters: event Ignored.