phing-listener

# Class: AnsiColorLogger Source Location: /listener/AnsiColorLogger.php
### Class Overview
    DefaultLogger
       |
       --AnsiColorLogger
Uses ANSI Color Code Sequences to colorize messages sent to the console. #### Author(s): Magesh Umasankar (Ant) Hans Lellelid <hans@xmpl.org> (Phing) #### Version: $Revision: 526 $ #### Copyright: � 2001,2002 THYRELL. All rights reserved | ### Constants ATTR_BLINK ATTR_BRIGHT ATTR_DIM ATTR_HIDDEN ATTR_NORMAL ATTR_REVERSE ATTR_UNDERLINE BG_BLACK BG_BLUE BG_CYAN BG_GREEN BG_MAGENTA BG_RED BG_WHITE BG_YELLOW END_COLOR FG_BLACK FG_BLUE FG_CYAN FG_GREEN FG_MAGENTA FG_RED FG_WHITE FG_YELLOW PREFIX SEPARATOR SUFFIX | ### Methods __construct printMessage
### Inherited Constants #### Class: DefaultLogger DefaultLogger::LEFT_COLUMN_SIZE | ### Inherited Variables #### Class: DefaultLogger DefaultLogger::$err DefaultLogger::$msgOutputLevel DefaultLogger::$out DefaultLogger::$startTime | ### Inherited Methods #### Class: DefaultLogger DefaultLogger::__construct() Construct a new default logger. DefaultLogger::buildFinished() Prints whether the build succeeded or failed, and any errors that occured during the build. Also outputs the total build-time. DefaultLogger::buildStarted() Sets the start-time when the build started. Used for calculating the build-time. DefaultLogger::formatTime() Formats a time micro integer to human readable format. DefaultLogger::getBuildFailedMessage() Get the message to return when a build failed. DefaultLogger::getBuildSuccessfulMessage() Get the message to return when a build succeeded. DefaultLogger::messageLogged() Print a message to the stdout. DefaultLogger::printMessage() Prints a message to console. DefaultLogger::setErrorStream() Sets the error stream. DefaultLogger::setMessageOutputLevel() Set the msgOutputLevel this logger is to respond to. DefaultLogger::setOutputStream() Sets the output stream. DefaultLogger::targetFinished() Fired when a target has finished. We don't need specific action on this event. So the methods are empty. DefaultLogger::targetStarted() Prints the current target name DefaultLogger::taskFinished() Fired when a task has finished. We don't need specific action on this event. So the methods are empty. DefaultLogger::taskStarted() Fired when a task is started. We don't need specific action on this event. So the methods are empty.
### Class Details [line 100] 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: ANSI COLOR LOGGER CONFIGURATION Format for AnsiColorLogger.*= Attribute;Foreground;Background Attribute is one of the following: -> Reset All Attributes (return to normal mode) -> Bright (Usually turns on BOLD) -> Dim -> 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 #### Tags:
author: | Magesh Umasankar (Ant)
author: | Hans Lellelid <hans@xmpl.org> (Phing)
version: | $Revision: 526 $
copyright: | � 2001,2002 THYRELL. All rights reserved
[ Top ] ### Class Methods ### constructor __construct [line 145]
`AnsiColorLogger __construct( )`
Construct new AnsiColorLogger Perform initializations that cannot be done in var declarations. #### Tags:
access: | public
Overrides DefaultLogger::__construct() (Construct a new default logger.) [ Top ] ### method printMessage [line 205]
`void printMessage( string $message, $stream, int $priority)`
#### Tags:
see: | printMessage
access: | protected
Overrides DefaultLogger::printMessage() (Prints a message to console.) #### Parameters:
string | $message |
OutputStream | $stream |
int | $priority |
[ Top ] ### Class Constants #### ATTR_BLINK = 5 [line 106] [ Top ] #### ATTR_BRIGHT = 1 [line 103] [ Top ] #### ATTR_DIM = 2 [line 104] [ Top ] #### ATTR_HIDDEN = 8 [line 108] [ Top ] #### ATTR_NORMAL = 0 [line 102] [ Top ] #### ATTR_REVERSE = 7 [line 107] [ Top ] #### ATTR_UNDERLINE = 3 [line 105] [ Top ] #### BG_BLACK = 40 [line 119] [ Top ] #### BG_BLUE = 44 [line 123] [ Top ] #### BG_CYAN = 46 [line 125] [ Top ] #### BG_GREEN = 42 [line 121] [ Top ] #### BG_MAGENTA = 45 [line 124] [ Top ] #### BG_RED = 41 [line 120] [ Top ] #### BG_WHITE = 47 [line 126] [ Top ] #### BG_YELLOW = 44 [line 122] [ Top ] #### END_COLOR = "\x1b[m" [line 131] [ Top ] #### FG_BLACK = 30 [line 110] [ Top ] #### FG_BLUE = 34 [line 114] [ Top ] #### FG_CYAN = 36 [line 116] [ Top ] #### FG_GREEN = 32 [line 112] [ Top ] #### FG_MAGENTA = 35 [line 115] [ Top ] #### FG_RED = 31 [line 111] [ Top ] #### FG_WHITE = 37 [line 117] [ Top ] #### FG_YELLOW = 33 [line 113] [ Top ] #### PREFIX = "\x1b[" [line 128] [ Top ] #### SEPARATOR = ';' [line 130] [ Top ] #### SUFFIX = "m" [line 129] [ Top ] Documentation generated on Mon, 19 Oct 2009 10:50:19 +0200 by phpDocumentor 1.4.3