listener/XmlLogger.php

Show: inherited
Table of Contents

\XmlLogger

Package: phing\listener

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

.

Parent(s)
\BuildLogger < \BuildListener
Author
Michiel Rook  
Version
$Id: aaf7d77e9952319b9598d786c556be005d34c188 $  

Constants

Constant  BUILD_TAG = "build"

XML element name for a build.

Constant  TARGET_TAG = "target"

XML element name for a target.

Constant  TASK_TAG = "task"

XML element name for a task.

Constant  MESSAGE_TAG = "message"

XML element name for a message.

Constant  NAME_ATTR = "name"

XML attribute name for a name.

Constant  TIME_ATTR = "time"

XML attribute name for a time.

Constant  PRIORITY_ATTR = "priority"

XML attribute name for a message priority.

Constant  LOCATION_ATTR = "location"

XML attribute name for a file location.

Constant  ERROR_ATTR = "error"

XML attribute name for an error description.

Constant  STACKTRACE_TAG = "stacktrace"

XML element name for a stack trace.

Properties

Propertyprivate\DOMElement  $buildElement= ''

Top-level (root) build element
Details
Type
\DOMElement
Propertyprivateint  $buildTimerStart= '0'

Start time for entire build.
Default value0Details
Type
int
Propertyprivate\DOMDocument  $doc= ''

The XML document created by this logger.
Details
Type
\DOMDocument
Propertyprivatearray  $elementStack= 'array()'

DOMElement[] The parent of the element being processed.
Default valuearray()Details
Type
array
Propertyprivate\OutputStream  $err= ''

Stream to use for error output.
Details
Type
\OutputStream
Propertyprivateint  $msgOutputLevel= 'Project::MSG_DEBUG'

Default valueProject::MSG_DEBUGDetails
Type
int
Propertyprivate\OutputStream  $out= ''

Stream to use for standard output.
Details
Type
\OutputStream
Propertyprivatestring  $outFilename= ''

Name of filename to create.
Details
Type
string
Propertyprivatearray  $timesStack= 'array()'

int[] Array of millisecond times for the various elements being processed.
Default valuearray()Details
Type
array

Methods

methodpublic__construct( ) : void

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

methodpublicbuildFinished( \BuildEvent $event ) : void

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

Parameters
Name Type Description
$event \BuildEvent

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

methodpublicbuildStarted( \BuildEvent $event ) : void

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

Parameters
Name Type Description
$event \BuildEvent

Ignored.

methodpublicmessageLogged( \BuildEvent $event ) : void

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.

Parameters
Name Type Description
$event \BuildEvent

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

methodpublicsetErrorStream( \OutputStream $err ) : void

Sets the error stream.

Parameters
Name Type Description
$err \OutputStream
Details
See
\BuildLogger#setErrorStream()  
methodpublicsetMessageOutputLevel( int $level ) : void

Set the msgOutputLevel this logger is to respond to.

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.

Parameters
Name Type Description
$level int

The logging level for the logger.

Details
See
\BuildLogger#setMessageOutputLevel()  
methodpublicsetOutputStream( \OutputStream $output ) : void

Sets the output stream.

Parameters
Name Type Description
$output \OutputStream
Details
See
\BuildLogger#setOutputStream()  
methodpublictargetFinished( \BuildEvent $event ) : void

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

Parameters
Name Type Description
$event \BuildEvent

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

methodpublictargetStarted( \BuildEvent $event ) : void

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

Parameters
Name Type Description
$event \BuildEvent

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

methodpublictaskFinished( \BuildEvent $event ) : void

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

Parameters
Name Type Description
$event \BuildEvent

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

methodpublictaskStarted( \BuildEvent $event ) : void

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

Parameters
Name Type Description
$event \BuildEvent

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

Documentation was generated by DocBlox 0.18.1.