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

# Class NoBannerLogger

java.lang.Object
org.apache.tools.ant.DefaultLogger
org.apache.tools.ant.NoBannerLogger

All Implemented Interfaces:
  `EventListener, BuildListener, BuildLogger`

Direct Known Subclasses:
  `SimpleBigProjectLogger`

public class NoBannerLogger extends DefaultLogger
Extends DefaultLogger to strip out empty targets.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected String`
  `targetName`
  Name of the current target, if it should be displayed on the next message.

  ### 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
  `NoBannerLogger()`
  Sole constructor.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected String`
  `extractTargetName(BuildEvent event)`
  Override point, extract the target name
  `void`
  `messageLogged(BuildEvent event)`
  Logs a message for a target if it is of an appropriate priority, also logging the name of the target if this is the first message which needs to be logged for the target.
  `void`
  `targetFinished(BuildEvent event)`
  Resets the current target name to `null`.
  `void`
  `targetStarted(BuildEvent event)`
  Notes the name of the target so it can be logged if it generates any messages.

  ### Methods inherited from class DefaultLogger

  `buildFinished, buildStarted, extractProjectName, formatTime, getBuildFailedMessage, getBuildSuccessfulMessage, getMessageOutputLevel, getTimestamp, log, printMessage, setEmacsMode, setErrorPrintStream, setMessageOutputLevel, setOutputPrintStream, 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.
  `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.
  `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.
  `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`
  `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

  - ### targetName

    protected String targetName
    Name of the current target, if it should be displayed on the next message. This is set when a target starts building, and reset to `null` after the first message for the target is logged.

- ## Constructor Details

  - ### NoBannerLogger

    public NoBannerLogger()
    Sole constructor.

- ## Method Details

  - ### targetStarted

    public void targetStarted(BuildEvent event)
    Notes the name of the target so it can be logged if it generates any messages.
    Specified by:
      `targetStarted` in interface `BuildListener`
    Overrides:
      `targetStarted` in class `DefaultLogger`
    Parameters:
      `event` - A BuildEvent containing target information. Must not be `null`.
    See Also:
      - `BuildEvent.getTarget()`

  - ### extractTargetName

    protected String extractTargetName(BuildEvent event)
    Override point, extract the target name
    Parameters:
      `event` - the event to work on
    Returns:
      the target name to print
    Since:
      Ant1.7.1

  - ### targetFinished

    public void targetFinished(BuildEvent event)
    Resets the current target name to `null`.
    Specified by:
      `targetFinished` in interface `BuildListener`
    Overrides:
      `targetFinished` in class `DefaultLogger`
    Parameters:
      `event` - Ignored in this implementation.
    See Also:
      - `BuildEvent.getException()`

  - ### messageLogged

    public void messageLogged(BuildEvent event)
    Logs a message for a target if it is of an appropriate priority, also logging the name of the target if this is the first message which needs to be logged for the target.
    Specified by:
      `messageLogged` in interface `BuildListener`
    Overrides:
      `messageLogged` in class `DefaultLogger`
    Parameters:
      `event` - A BuildEvent containing message information. Must not be `null`.
    See Also:
      - `BuildEvent.getMessage()`
      - `BuildEvent.getException()`
      - `BuildEvent.getPriority()`