cvs: pear /Perm_LiveUser LiveUser.php

From: Date: Sun, 24 Oct 2004 17:34:34 +0000
Subject: cvs: pear /Perm_LiveUser LiveUser.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-25175@lists.php.net to get a copy of this message
arnaud Sun Oct 24 13:34:34 2004 EDT Modified files: /pear/Perm_LiveUser LiveUser.php Log: * lazy loading of PEAR::log http://cvs.php.net/diff.php/pear/Perm_LiveUser/LiveUser.php?r1=1.132&r2=1.133&ty=u Index: pear/Perm_LiveUser/LiveUser.php diff -u pear/Perm_LiveUser/LiveUser.php:1.132 pear/Perm_LiveUser/LiveUser.php:1.133 --- pear/Perm_LiveUser/LiveUser.php:1.132 Sat Oct 23 10:00:35 2004 +++ pear/Perm_LiveUser/LiveUser.php Sun Oct 24 13:34:33 2004 @@ -34,7 +34,6 @@ */ require_once 'PEAR/ErrorStack.php'; require_once 'PEAR.php'; -require_once 'Log.php'; /**#@+ * Error related constants definition @@ -119,7 +118,7 @@ * @author Lukas Smith <smith@backendmedia.com> * @author Pierre-Alain Joye <pajoye@php.net> * @author Arnaud Limbourg <arnaud@php.net> - * @version $Id: LiveUser.php,v 1.132 2004/10/23 14:00:35 arnaud Exp $ + * @version $Id: LiveUser.php,v 1.133 2004/10/24 17:34:33 arnaud Exp $ * @package LiveUser */ class LiveUser @@ -285,6 +284,14 @@ ); /** + * For lazy loading of PEAR::Log + * + * @acess private + * @var boolean + */ + var $_log_loaded = false; + + /** * Constructor * * @access protected @@ -293,11 +300,12 @@ function LiveUser() { $this->_stack = &PEAR_ErrorStack::singleton('LiveUser'); - $this->_log = &Log::factory('composite'); - $this->_stack->setLogger($this->_log); if ($GLOBALS['_LIVEUSER_DEBUG']) { - $this->_log->addChild(Log::factory('display')); + if (!$this->_log_loaded) { + $this->loadPEARLog(); + } + $this->_log->addChild(Log::factory('win')); } $this->_stack->setErrorMessageTemplate($this->_errorMessages); @@ -671,6 +679,9 @@ */ function addErrorLog(&$log) { + if (!$this->_log_loaded) { + $this->loadPEARLog(); + } return $this->_log->addChild($log); } @@ -1661,5 +1672,19 @@ // return the textual error message corresponding to the code return isset($statusMessages[$value]) ? $statusMessages[$value] : $statusMessages[LIVEUSER_STATUS_UNKNOWN]; } + + /** + * This method lazy loads PEAR::Log + * + * @access protected + * @return void + */ + function loadPEARLog() + { + require 'Log.php'; + $this->_log = &Log::factory('composite'); + $this->_stack->setLogger($this->_log); + $this->_log_loaded = true; + } } // end class LiveUser ?>

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