XmlLogger

Implements \BuildLogger

Generates a file in the current directory with an XML description of what happened during a build.

The default filename is "log.xml", but this can be overridden with the property XmlLogger.file.

author

Michiel Rook mrook@php.net

version

$Id: 534a60eca6b0c4803103b490663a64d85b052e5a $

package

phing.listener

Methods

Constructs a new BuildListener that logs build events to an XML file.

__construct() 

Fired when the build finishes, this adds the time taken and any error stacktrace to the build element and writes the document to disk.

buildFinished(\BuildEvent $event) 
throws

Arguments

$event

\BuildEvent

An event with any relevant extra information. Will not be null.

Fired when the build starts, this builds the top-level element for the document and remembers the time of the start of the build.

buildStarted(\BuildEvent $event) 

Arguments

$event

\BuildEvent

getBuildElement

getBuildElement() : \DOMElement

Response

\DOMElement

getBuildTimerStart

getBuildTimerStart() : integer

Response

integer

getDoc

getDoc() : \DOMDocument

Response

\DOMDocument

getElementStack

getElementStack() : array

Response

array

getErr

getErr() : \OutputStream

Response

\OutputStream

getMsgOutputLevel

getMsgOutputLevel() : integer

Response

integer

getOut

getOut() : \OutputStream

Response

\OutputStream

getOutFilename

getOutFilename() : string

Response

string

getTimesStack

getTimesStack() : array

Response

array

Fired when a message is logged, this adds a message element to the most appropriate parent element (task, target or build) and records the priority and text of the message.

messageLogged(\BuildEvent $event) 

Arguments

$event

\BuildEvent

setBuildElement

setBuildElement( $elem) 

Arguments

$elem

Sets this logger to produce emacs (and other editor) friendly output.

setEmacsMode(boolean $emacsMode) 

Arguments

$emacsMode

boolean

true if output is to be unadorned so that emacs and other editors can parse files names, etc.

Sets the error stream.

setErrorStream(\OutputStream $err) 
see \BuildLogger#setErrorStream()

Arguments

$err

\OutputStream

Configured output stream (e.g. STDERR) for errors.

Set the msgOutputLevel this logger is to respond to.

setMessageOutputLevel(integer $level) 

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

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 \BuildLogger#setMessageOutputLevel()

Arguments

$level

integer

The logging level for the logger.

Sets the output stream.

setOutputStream(\OutputStream $output) 
see \BuildLogger#setOutputStream()

Arguments

$output

\OutputStream

Configured output stream (e.g. STDOUT) for standard output.

Fired when a target finishes building, this adds the time taken to the appropriate target element in the log.

targetFinished(\BuildEvent $event) 

Arguments

$event

\BuildEvent

An event with any relevant extra information. Will not be null.

Fired when a target starts building, remembers the current time and the name of the target.

targetStarted(\BuildEvent $event) 

Arguments

$event

\BuildEvent

An event with any relevant extra information. Will not be null.

Fired when a task finishes building, this adds the time taken to the appropriate task element in the log.

taskFinished(\BuildEvent $event) 

Arguments

$event

\BuildEvent

An event with any relevant extra information. Will not be null.

Fired when a task starts building, remembers the current time and the name of the task.

taskStarted(\BuildEvent $event) 

Arguments

$event

\BuildEvent

An event with any relevant extra information. Will not be null.

Constants

XML element name for a build.

BUILD_TAG

XML element name for a target.

TARGET_TAG

XML element name for a task.

TASK_TAG

XML element name for a message.

MESSAGE_TAG

XML attribute name for a name.

NAME_ATTR

XML attribute name for a time.

TIME_ATTR

XML attribute name for a message priority.

PRIORITY_ATTR

XML attribute name for a file location.

LOCATION_ATTR

XML attribute name for an error description.

ERROR_ATTR

XML element name for a stack trace.

STACKTRACE_TAG

Properties

The XML document created by this logger.

doc : \DOMDocument
var

The XML document created by this logger.

Type(s)

\DOMDocument

Start time for entire build.

buildTimerStart : integer
var

Start time for entire build.

Type(s)

integer

Top-level (root) build element

buildElement : \DOMElement
var

Top-level (root) build element

Type(s)

\DOMElement

DOMElement[] The parent of the element being processed.

elementStack : array
var

DOMElement[] The parent of the element being processed.

Type(s)

array

int[] Array of millisecond times for the various elements being processed.

timesStack : array
var

int[] Array of millisecond times for the various elements being processed.

Type(s)

array

msgOutputLevel

msgOutputLevel : integer
var

Type(s)

integer

Stream to use for standard output.

out : \OutputStream
var

Stream to use for standard output.

Type(s)

\OutputStream

Stream to use for error output.

err : \OutputStream
var

Stream to use for error output.

Type(s)

\OutputStream

Name of filename to create.

outFilename : string
var

Name of filename to create.

Type(s)

string