cvs: pear /Log/Log composite.php

From: Date: Thu, 03 Apr 2003 06:24:46 +0000
Subject: cvs: pear /Log/Log composite.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-9712@lists.php.net to get a copy of this message
jon Thu Apr 3 01:24:46 2003 EDT Modified files: /pear/Log/Log composite.php Log: Clean up the overall style of this file. Index: pear/Log/Log/composite.php diff -u pear/Log/Log/composite.php:1.8 pear/Log/Log/composite.php:1.9 --- pear/Log/Log/composite.php:1.8 Mon Dec 2 00:23:00 2002 +++ pear/Log/Log/composite.php Thu Apr 3 01:24:46 2003 @@ -1,45 +1,48 @@ <?php -// $Id: composite.php,v 1.8 2002/12/02 05:23:00 jon Exp $ +// $Id: composite.php,v 1.9 2003/04/03 06:24:46 jon Exp $ // $Horde: horde/lib/Log/composite.php,v 1.2 2000/06/28 21:36:13 jon Exp $ /** * The Log_composite:: class implements a Composite pattern which - * allows multiple Log implementations to get sent the same events. + * allows multiple Log implementations to receive the same events. * * @author Chuck Hagenbuch <chuck@horde.org> - * @version $Revision: 1.8 $ + * @author Jon Parise <jon@php.net> + * @version $Revision: 1.9 $ * @since Horde 1.3 - * @package Log + * @package Log */ -class Log_composite extends Log { - - /** - * Array holding all Log instances - * which should be sent events sent to the composite. - * @var array - */ +class Log_composite extends Log +{ + /** + * Array holding all of the Log instances to which log events should be + * sent. + * + * @var array + */ var $_children = array(); /** - * Constructs a new composite Log object. - * - * @param boolean $name This is ignored. - * @param boolean $ident This is ignored. - * @param boolean $conf This is ignored. - * @param boolean $maxLevel This is ignored. + * Construct a new composite Log object. + * + * @param boolean $name This parameter is ignored. + * @param boolean $ident This parameter is ignored. + * @param boolean $conf This parameter is ignored. + * @param boolean $maxLevel This parameter is ignored. + * * @access public */ function Log_composite($name = false, $ident = false, $conf = false, $maxLevel = PEAR_LOG_DEBUG) { } - + /** - * Open the log connections of each and every child of this - * composite. - * @access public + * Open the child connections. + * + * @access public */ function open() { @@ -52,9 +55,9 @@ } /** - * If we've gone ahead and opened each child, go through and close - * each child. - * @access public + * Close any child instances. + * + * @access public */ function close() { @@ -67,15 +70,20 @@ } /** - * Sends $message and $priority to every child of this composite. - * - * @param string $message The textual message to be logged. - * @param string $priority (optional) The priority of the message. Valid - * values are: PEAR_LOG_EMERG, PEAR_LOG_ALERT, - * PEAR_LOG_CRIT, PEAR_LOG_ERR, PEAR_LOG_WARNING, - * PEAR_LOG_NOTICE, PEAR_LOG_INFO, and PEAR_LOG_DEBUG. - * The default is PEAR_LOG_INFO. - * @return boolean True on success or false on failure. + * Send $message and $priority to each child of this composite. + * + * @param string $message The textual message to be logged. + * @param string $priority (optional) The priority of the message. + * Valid values are: PEAR_LOG_EMERG, + * PEAR_LOG_ALERT, PEAR_LOG_CRIT, + * PEAR_LOG_ERR, PEAR_LOG_WARNING, + * PEAR_LOG_NOTICE, PEAR_LOG_INFO, and + * PEAR_LOG_DEBUG. + * The default is PEAR_LOG_INFO. + * + * @return boolean True if the entry is successfully logged. + * + * @access public */ function log($message, $priority = PEAR_LOG_INFO) { @@ -83,16 +91,17 @@ foreach ($this->_children as $child) { $child->log($message, $priority); } - + $this->notifyAll(array('priority' => $priority, 'message' => $message)); return true; } /** - * @return boolean true if this is a composite class, false - * otherwise. Always returns true since this is the composite - * subclass. + * Return true if this is a composite. + * + * @return boolean True if this is a composite class. + * * @access public */ function isComposite() @@ -101,12 +110,13 @@ } /** - * Add a Log instance to the list of children that messages sent - * to us should be passed on to. + * Add a Log instance to the list of children. + * + * @param object $child The Log instance to add. * - * @param object Log &$child The Log instance to add. - * @access public - * @return boolean false, if &$child isn't a Log instance + * @return boolean True if the Log instance was successfully added. + * + * @access public */ function addChild(&$child) { @@ -117,14 +127,16 @@ $child->_childID = uniqid(rand()); $this->_children[$child->_childID] = &$child; + + return true; } /** - * Remove a Log instance from the list of children that messages - * sent to us should be passed on to. + * Remove a Log instance from the list of children. + * + * @param object $child The Log instance to remove. * - * @param object Log $child The Log instance to remove. - * @access public + * @access public */ function removeChild($child) {

« previous php.pear.cvs (#9712) next »