classes/phing/listener/XmlLogger.php

\XmlLogger

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.

Implements
\BuildLogger
author
Michiel Rook
package
phing.listener
version
$Id: XmlLogger.php 552 2009-08-29 12:18:13Z mrook $

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 valuearrayDetails
Type
array
Propertyprivate\OutputStream  $err= ''

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

Default valueProjectDetails
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 valuearrayDetails
Type
array

Methods

methodpublic  __construct( ) :
Constructs a new BuildListener that logs build events to an XML file.
methodpublic  buildFinished( \BuildEvent $event ) :
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.

methodpublic  buildStarted( \BuildEvent $event ) :
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.
methodpublic  messageLogged( \BuildEvent $event ) :
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.

methodpublic  setErrorStream( \OutputStream $err ) :
Sets the error stream.
Parameters
Name Type Description
$err \OutputStream
Details
see
\BuildLogger#setErrorStream()
methodpublic  setMessageOutputLevel( int $level ) :
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()
methodpublic  setOutputStream( \OutputStream $output ) :
Sets the output stream.
Parameters
Name Type Description
$output \OutputStream
Details
see
\BuildLogger#setOutputStream()
methodpublic  targetFinished( \BuildEvent $event ) :
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.

methodpublic  targetStarted( \BuildEvent $event ) :
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.

methodpublic  taskFinished( \BuildEvent $event ) :
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.

methodpublic  taskStarted( \BuildEvent $event ) :
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.13.1.