TimestampedLogger (Apache Ant API)
Description: declaration: package: org.apache.tools.ant.listener, class: TimestampedLogger

# Class TimestampedLogger

java.lang.Object
org.apache.tools.ant.DefaultLogger
org.apache.tools.ant.listener.TimestampedLogger

All Implemented Interfaces:
  `EventListener, BuildListener, BuildLogger`

public class TimestampedLogger extends DefaultLogger
Like a normal logger, except with timed outputs

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `SPACER`
  what appears between the old message and the new

  ### Fields inherited from class DefaultLogger

  `emacsMode, err, LEFT_COLUMN_SIZE, lSep, msgOutputLevel, out`
  Modifier and Type
  Field
  Description
  `protected boolean`
  `emacsMode`
  Whether or not to use emacs-style output
  `protected PrintStream`
  `err`
  PrintStream to write error messages to
  `static final int`
  `LEFT_COLUMN_SIZE`
  Size of left-hand column for right-justified task name.
  `protected static final String`
  `lSep`
  Deprecated.
  `protected int`
  `msgOutputLevel`
  Lowest level of message to write out
  `protected PrintStream`
  `out`
  PrintStream to write non-error messages to

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `TimestampedLogger()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `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.

  ### Methods inherited from class DefaultLogger

  `buildFinished, buildStarted, extractProjectName, formatTime, getMessageOutputLevel, getTimestamp, log, messageLogged, printMessage, setEmacsMode, setErrorPrintStream, setMessageOutputLevel, setOutputPrintStream, targetFinished, targetStarted, taskFinished, taskStarted`
  Modifier and Type
  Method
  Description
  `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.
  `int`
  `getMessageOutputLevel()`
  `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.

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### SPACER

    public static final String SPACER
    what appears between the old message and the new
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### TimestampedLogger

    public TimestampedLogger()

- ## Method Details

  - ### getBuildFailedMessage

    protected String getBuildFailedMessage()
    This is an override point: the message that indicates whether a build failed. Subclasses can change/enhance the message.
    Overrides:
      `getBuildFailedMessage` in class `DefaultLogger`
    Returns:
      The classic "BUILD FAILED" plus a timestamp

  - ### getBuildSuccessfulMessage

    protected String getBuildSuccessfulMessage()
    This is an override point: the message that indicates that a build succeeded. Subclasses can change/enhance the message.
    Overrides:
      `getBuildSuccessfulMessage` in class `DefaultLogger`
    Returns:
      The classic "BUILD SUCCESSFUL" plus a timestamp