cvs: pear /Log Log.php composite.php file.php sql.php

From: Date: Mon, 21 Jan 2002 17:23:32 +0000
Subject: cvs: pear /Log Log.php composite.php file.php sql.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-2046@lists.php.net to get a copy of this message
jon Mon Jan 21 12:23:32 2002 EDT Modified files: /pear/Log Log.php composite.php file.php sql.php Log: - update email address - style Index: pear/Log/Log.php diff -u pear/Log/Log.php:1.3 pear/Log/Log.php:1.4 --- pear/Log/Log.php:1.3 Tue Oct 16 14:30:40 2001 +++ pear/Log/Log.php Mon Jan 21 12:23:32 2002 @@ -1,5 +1,5 @@ <?php -// $Id: Log.php,v 1.3 2001/10/16 18:30:40 andrei Exp $ +// $Id: Log.php,v 1.4 2002/01/21 17:23:32 jon Exp $ // $Horde: horde/lib/Log.php,v 1.15 2000/06/29 23:39:45 jon Exp $ /** @@ -7,8 +7,8 @@ * mechanisms and the Subject end of a Subject-Observer pattern. * * @author Chuck Hagenbuch <chuck@horde.org> - * @author Jon Parise <jon@csh.rit.edu> - * @version $Revision: 1.3 $ + * @author Jon Parise <jon@horde.org> + * @version $Revision: 1.4 $ * @since Horde 1.3 * @package Log */ @@ -110,6 +110,7 @@ if (!isset($instances[$signature])) { $instances[$signature] = Log::factory($log_type, $log_name, $ident, $conf); } + return $instances[$signature]; } @@ -132,6 +133,7 @@ LOG_INFO => 'info', LOG_DEBUG => 'debug' ); + return $priorities[$priority]; } @@ -139,14 +141,16 @@ * Adds a Log_observer instance to the list of observers that are * be notified when a message is logged. * - * @param object Log_observer &$logObserver The Log_observer instance to be added to - * the $listeners array. + * @param object Log_observer &$logObserver The Log_observer instance to + * be added to the $listeners + * array. * @access public */ function attach(&$logObserver) { - if (!is_object($logObserver)) + if (!is_object($logObserver)) { return false; + } $logObserver->_listenerID = uniqid(rand()); @@ -156,14 +160,16 @@ /** * Removes a Log_observer instance from the list of observers. * - * @param object Log_observer $logObserver The Log_observer instance to be removed - * from the $listeners array. + * @param object Log_observer $logObserver The Log_observer instance to + * be removed from the $listeners + * array. * @access public */ function detach($logObserver) { - if (isset($this->listeners[$logObserver->_listenerID])) + if (isset($this->listeners[$logObserver->_listenerID])) { unset($this->listeners[$logObserver->_listenerID]); + } } /** @@ -178,8 +184,9 @@ { reset($this->listeners); foreach ($this->listeners as $listener) { - if ($messageOb['priority'] <= $listener->priority) + if ($messageOb['priority'] <= $listener->priority) { $listener->notify($messageOb); + } } } Index: pear/Log/composite.php diff -u pear/Log/composite.php:1.2 pear/Log/composite.php:1.3 --- pear/Log/composite.php:1.2 Tue Aug 7 22:53:05 2001 +++ pear/Log/composite.php Mon Jan 21 12:23:32 2002 @@ -1,5 +1,5 @@ <?php -// $Id: composite.php,v 1.2 2001/08/08 02:53:05 alexmerz Exp $ +// $Id: composite.php,v 1.3 2002/01/21 17:23:32 jon Exp $ // $Horde: horde/lib/Log/composite.php,v 1.2 2000/06/28 21:36:13 jon Exp $ /** @@ -7,7 +7,7 @@ * allows multiple Log implementations to get sent the same events. * * @author Chuck Hagenbuch <chuck@horde.org> - * @version $Revision: 1.2 $ + * @version $Revision: 1.3 $ * @since Horde 1.3 * @package Log */ @@ -122,8 +122,9 @@ */ function removeChild($child) { - if (isset($this->children[$child->_childID])) + if (isset($this->children[$child->_childID])) { unset($this->children[$child->_childID]); + } } } Index: pear/Log/file.php diff -u pear/Log/file.php:1.3 pear/Log/file.php:1.4 --- pear/Log/file.php:1.3 Tue Aug 7 22:53:05 2001 +++ pear/Log/file.php Mon Jan 21 12:23:32 2002 @@ -1,13 +1,13 @@ <?php -// $Id: file.php,v 1.3 2001/08/08 02:53:05 alexmerz Exp $ +// $Id: file.php,v 1.4 2002/01/21 17:23:32 jon Exp $ // $Horde: horde/lib/Log/file.php,v 1.4 2000/06/28 21:36:13 jon Exp $ /** * The Log_file class is a concrete implementation of the Log:: * abstract class which writes message to a text file. * - * @author Jon Parise <jon@csh.rit.edu> - * @version $Revision: 1.3 $ + * @author Jon Parise <jon@horde.org> + * @version $Revision: 1.4 $ * @since Horde 1.3 * @package Log */ @@ -88,7 +88,7 @@ $this->open(); } - $entry = sprintf("%s %s [%s] %s\n", strftime("%b %d %T"), + $entry = sprintf("%s %s [%s] %s\n", strftime('%b %d %T'), $this->ident, Log::priorityToString($priority), $message); if ($this->fp) { Index: pear/Log/sql.php diff -u pear/Log/sql.php:1.2 pear/Log/sql.php:1.3 --- pear/Log/sql.php:1.2 Tue Aug 7 22:53:05 2001 +++ pear/Log/sql.php Mon Jan 21 12:23:32 2002 @@ -1,5 +1,5 @@ <?php -// $Id: sql.php,v 1.2 2001/08/08 02:53:05 alexmerz Exp $ +// $Id: sql.php,v 1.3 2002/01/21 17:23:32 jon Exp $ // $Horde: horde/lib/Log/sql.php,v 1.12 2000/08/16 20:27:34 chuck Exp $ require_once 'DB.php'; @@ -19,8 +19,8 @@ * primary key (unixtime, ident) * ); * - * @author Jon Parise <jon@csh.rit.edu> - * @version $Revision: 1.2 $ + * @author Jon Parise <jon@horde.org> + * @version $Revision: 1.3 $ * @since Horde 1.3 * @package Log */ @@ -82,6 +82,7 @@ } $this->opened = true; } + return true; } @@ -97,6 +98,7 @@ $this->opened = false; return $this->db->disconnect(); } + return true; } @@ -114,7 +116,9 @@ */ function log($message, $priority = LOG_INFO) { - if (!$this->opened) $this->open(); + if (!$this->opened) { + $this->open(); + } $timestamp = time(); $q = "insert into $this->table

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