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: aaf7d77e9952319b9598d786c556be005d34c188 $

package

phing.listener

Methods

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

__construct() 

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

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) 

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 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 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.

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 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

Set the msgOutputLevel this logger is to respond to.

setMessageOutputLevel(int $level) 

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

Arguments

$level

int

The logging level for the logger.

Sets the output stream.

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

Arguments

$output

\OutputStream

Sets the error stream.

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

Arguments

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 : int
var

Start time for entire build.

Type(s)

int

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 : int
var

Type(s)

int

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