Uses ANSI Color Code Sequences to colorize messages sent to the console.

If used with the -logfile option, the output file will contain all the necessary escape codes to display the text in colorized mode when displayed in the console using applications like cat, more, etc.

This is designed to work on terminals that support ANSI color codes. It works on XTerm, ETerm, Mindterm, etc. It also works on Win9x (with ANSI.SYS loaded.)

NOTE: It doesn't work on WinNT's COMMAND.COM even with ANSI.SYS loaded.

The default colors used for differentiating the message levels can be changed by editing the phing/listener/defaults.properties file.

This file contains 5 key/value pairs: AnsiColorLogger.ERROR_COLOR=2;31 AnsiColorLogger.WARNING_COLOR=2;35 AnsiColorLogger.INFO_COLOR=2;36 AnsiColorLogger.VERBOSE_COLOR=2;32 AnsiColorLogger.DEBUG_COLOR=2;34

Another option is to pass a system variable named ant.logger.defaults, with value set to the path of the file that contains user defined Ansi Color Codes, to the java command using -D option.

To change these colors use the following chart:

     <B>ANSI COLOR LOGGER CONFIGURATION</B>

Format for AnsiColorLogger.*= Attribute;Foreground;Background

Attribute is one of the following: 0 -> Reset All Attributes (return to normal mode) 1 -> Bright (Usually turns on BOLD) 2 -> Dim 3 -> Underline 5 -> link 7 -> Reverse 8 -> Hidden

Foreground is one of the following: 30 -> Black 31 -> Red 32 -> Green 33 -> Yellow 34 -> Blue 35 -> Magenta 36 -> Cyan 37 -> White

Background is one of the following: 40 -> Black 41 -> Red 42 -> Green 43 -> Yellow 44 -> Blue 45 -> Magenta 46 -> Cyan 47 -> White

author | Hans Lellelid <hans@xmpl.org> (Phing)
author | Magesh Umasankar (Ant)
package | phing.listener
version | $Id$

### Methods

## Construct new AnsiColorLogger Perform initializations that cannot be done in var declarations.

    __construct()

## Prints whether the build succeeded or failed, and any errors that occured during the build.

    buildFinished(\BuildEvent $event)

Inherited

Also outputs the total build-time.

inherited_from | \DefaultLogger::buildFinished()

### Parameters

#### $event

`object`

The BuildEvent @see BuildEvent::getException()

## Sets the start-time when the build started.

    buildStarted(\BuildEvent $event)

Inherited

Used for calculating the build-time.

inherited_from | \DefaultLogger::buildStarted()

### Parameters

#### $event

`object`

The BuildEvent @access public

## Formats a time micro integer to human readable format.

    formatTime($micros)

Inherited Static

@param integer The time stamp

access | private
inherited_from | \DefaultLogger::formatTime()

### Parameters

#### $micros

## Sets the error stream.

    setErrorStream(\OutputStream $err)

Inherited

see | \global\BuildLogger#setErrorStream()
inherited_from | \DefaultLogger::setErrorStream()

### Parameters

#### $err

`\OutputStream`

## Set the msgOutputLevel this logger is to respond to.

    setMessageOutputLevel(int $level)

Inherited

Only messages with a message level lower than or equal to the given level are output to the log.

<

p> Constants for the message levels are in Project.php. The order of the levels, from least to most verbose, is:

- Project::MSG_ERR
- Project::MSG_WARN
- Project::MSG_INFO
- Project::MSG_VERBOSE
- Project::MSG_DEBUG

The default message level for DefaultLogger is Project::MSG_ERR.

see | \global\BuildLogger#setMessageOutputLevel()
inherited_from | \DefaultLogger::setMessageOutputLevel()

### Parameters

#### $level

`int`

The logging level for the logger.

## Sets the output stream.

    setOutputStream(\OutputStream $output)

Inherited

see | \global\BuildLogger#setOutputStream()
inherited_from | \DefaultLogger::setOutputStream()

### Parameters

#### $output

`\OutputStream`

## Fired when a target has finished.

    targetFinished(\BuildEvent $event)

Inherited

We don't need specific action on this event. So the methods are empty.

inherited_from | \DefaultLogger::targetFinished()

### Parameters

#### $event

`object`

The BuildEvent @see BuildEvent::getException()

## Fired when a task has finished.

    taskFinished(\BuildEvent $event)

Inherited

We don't need specific action on this event. So the methods are empty.

inherited_from | \DefaultLogger::taskFinished()

### Parameters

#### $event

`object`

The BuildEvent @access public @see BuildEvent::getException()

## Fired when a task is started.

    taskStarted(\BuildEvent $event)

Inherited

We don't need specific action on this event. So the methods are empty.

inherited_from | \DefaultLogger::taskStarted()

### Parameters

#### $event

`object`

The BuildEvent @access public @see BuildEvent::getTask()

## Get the message to return when a build failed.

    getBuildFailedMessage() : string

Inherited

inherited_from | \DefaultLogger::getBuildFailedMessage()

### Returns

`string`The classic "BUILD FAILED"

## Get the message to return when a build succeeded.

    getBuildSuccessfulMessage() : string

Inherited

inherited_from | \DefaultLogger::getBuildSuccessfulMessage()

### Returns

`string`The classic "BUILD FINISHED"

## Prints a message to console.

    printMessage(string $message, \OutputStream $stream, int $priority) : void

see | \global\DefaultLogger#printMessage

### Parameters

#### $message

`string`

#### $stream

`\OutputStream`

#### $priority

`int`

## Set the colors to use from a property file specified by the special ant property ant.logger.defaults

    setColors()

### Properties

## Stream to use for error output.

    $err : \OutputStream

Inherited

inherited_from | \DefaultLogger::$$err

##

    $msgOutputLevel : int

Inherited

The default is

    Project::MSG_VERBOSE

.

inherited_from | \DefaultLogger::$$msgOutputLevel

## Stream to use for standard output.

    $out : \OutputStream

Inherited

inherited_from | \DefaultLogger::$$out

##

    $startTime

Inherited

@var int

inherited_from | \DefaultLogger::$$startTime

##

    $colorsSet

##

    $debugColor

##

    $errColor

##

    $infoColor

##

    $verboseColor

##

    $warnColor

### Constants

## ATTR_BLINK

    ATTR_BLINK

## ATTR_BRIGHT

    ATTR_BRIGHT

## ATTR_DIM

    ATTR_DIM

## ATTR_HIDDEN

    ATTR_HIDDEN

## ATTR_NORMAL

    ATTR_NORMAL

## ATTR_REVERSE

    ATTR_REVERSE

## ATTR_UNDERLINE

    ATTR_UNDERLINE

## BG_BLACK

    BG_BLACK

## BG_BLUE

    BG_BLUE

## BG_CYAN

    BG_CYAN

## BG_GREEN

    BG_GREEN

## BG_MAGENTA

    BG_MAGENTA

## BG_RED

    BG_RED

## BG_WHITE

    BG_WHITE

## BG_YELLOW

    BG_YELLOW

## END_COLOR

    END_COLOR

## FG_BLACK

    FG_BLACK

## FG_BLUE

    FG_BLUE

## FG_CYAN

    FG_CYAN

## FG_GREEN

    FG_GREEN

## FG_MAGENTA

    FG_MAGENTA

## FG_RED

    FG_RED

## FG_WHITE

    FG_WHITE

## FG_YELLOW

    FG_YELLOW

## Size of the left column in output.

    LEFT_COLUMN_SIZE : int

Inherited

The default char width is 12.

inherited_from | \DefaultLogger::LEFT_COLUMN_SIZE

## PREFIX

    PREFIX

## SEPARATOR

    SEPARATOR

## SUFFIX

    SUFFIX