PHP Class DefaultLogger, symfony-1.4

Currently, it only writes which targets are being executed, and any messages that get logged.
See also: BuildEvent
Author: Andreas Aderhold ([email protected])
Inheritance: implements StreamRequiredBuildLogger
显示文件 Open project: vjousse/symfony-1.4 Class Usage Examples

Protected Properties

Property Type Description
$err Stream to use for error output.
$msgOutputLevel integer @var int
$out Stream to use for standard output.
$startTime integer @var int

Public Methods

Method Description
__construct ( ) Construct a new default logger.
buildFinished ( BuildEvent $event ) Prints whether the build succeeded or failed, and any errors that occured during the build. Also outputs the total build-time.
buildStarted ( BuildEvent $event ) Sets the start-time when the build started. Used for calculating the build-time.
formatTime ( $micros ) Formats a time micro integer to human readable format.
messageLogged ( BuildEvent $event ) Print a message to the stdout.
setErrorStream ( OutputStream $err ) Sets the error stream.
setMessageOutputLevel ( integer $level ) Set the msgOutputLevel this logger is to respond to.
setOutputStream ( OutputStream $output ) Sets the output stream.
targetFinished ( BuildEvent $event ) Fired when a target has finished. We don't need specific action on this event. So the methods are empty.
targetStarted ( BuildEvent $event ) Prints the current target name
taskFinished ( BuildEvent $event ) Fired when a task has finished. We don't need specific action on this event. So the methods are empty.
taskStarted ( BuildEvent $event ) Fired when a task is started. We don't need specific action on this event. So the methods are empty.

Protected Methods

Method Description
getBuildFailedMessage ( ) : string Get the message to return when a build failed.
getBuildSuccessfulMessage ( ) : string Get the message to return when a build succeeded.
printMessage ( string $message, OutputStream $stream, integer $priority ) : void Prints a message to console.

Method Details

__construct() public method

Construct a new default logger.
public __construct ( )

buildFinished() public method

@param object The BuildEvent
See also: BuildEvent::getException()
public buildFinished ( BuildEvent $event )
$event BuildEvent

buildStarted() public method

@param object The BuildEvent
public buildStarted ( BuildEvent $event )
$event BuildEvent

formatTime() public static method

@param integer The time stamp
public static formatTime ( $micros )

getBuildFailedMessage() protected method

Get the message to return when a build failed.
protected getBuildFailedMessage ( ) : string
return string The classic "BUILD FAILED"

getBuildSuccessfulMessage() protected method

Get the message to return when a build succeeded.
protected getBuildSuccessfulMessage ( ) : string
return string The classic "BUILD FINISHED"

messageLogged() public method

@param object The BuildEvent
public messageLogged ( BuildEvent $event )
$event BuildEvent

printMessage() protected method

Prints a message to console.
protected printMessage ( string $message, OutputStream $stream, integer $priority ) : void
$message string The message to print. Should not be null.
$stream OutputStream The stream to use for message printing.
$priority integer The priority of the message. (Ignored in this implementation.)
return void

setErrorStream() public method

Sets the error stream.
public setErrorStream ( OutputStream $err )
$err OutputStream

setMessageOutputLevel() public method

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.
public setMessageOutputLevel ( integer $level )
$level integer The logging level for the logger.

setOutputStream() public method

Sets the output stream.
public setOutputStream ( OutputStream $output )
$output OutputStream

targetFinished() public method

@param object The BuildEvent
See also: BuildEvent::getException()
public targetFinished ( BuildEvent $event )
$event BuildEvent

targetStarted() public method

@param object The BuildEvent
public targetStarted ( BuildEvent $event )
$event BuildEvent

taskFinished() public method

@param object The BuildEvent
public taskFinished ( BuildEvent $event )
$event BuildEvent

taskStarted() public method

@param object The BuildEvent
public taskStarted ( BuildEvent $event )
$event BuildEvent

Property Details

$err protected_oe property

Stream to use for error output.
protected $err

$msgOutputLevel protected_oe property

@var int
protected int $msgOutputLevel
return integer

$out protected_oe property

Stream to use for standard output.
protected $out

$startTime protected_oe property

@var int
protected int $startTime
return integer