cvs: pear /LiveUser LiveUser.php
| From: | Lukas Smith | Date: | Tue, 28 Mar 2006 10:18:14 +0000 |
| Subject: | cvs: pear /LiveUser LiveUser.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-39385@lists.php.net to get a copy of this message | ||
lsmith Tue Mar 28 10:18:14 2006 UTC
Modified files:
/pear/LiveUser LiveUser.php
Log:
- expanded error handling in Log instance creation
http://cvs.php.net/viewcvs.cgi/pear/LiveUser/LiveUser.php?r1=1.154&r2=1.155&diff_format=u
Index: pear/LiveUser/LiveUser.php
diff -u pear/LiveUser/LiveUser.php:1.154 pear/LiveUser/LiveUser.php:1.155
--- pear/LiveUser/LiveUser.php:1.154 Thu Mar 23 11:43:49 2006
+++ pear/LiveUser/LiveUser.php Tue Mar 28 10:18:14 2006
@@ -40,7 +40,7 @@
* @author Bjoern Kraus <krausbn@php.net>
* @copyright 2002-2006 Markus Wolff
* @license http://www.gnu.org/licenses/lgpl.txt
- * @version CVS: $Id: LiveUser.php,v 1.154 2006/03/23 11:43:49 lsmith Exp $
+ * @version CVS: $Id: LiveUser.php,v 1.155 2006/03/28 10:18:14 lsmith Exp $
* @link http://pear.php.net/LiveUser
*/
@@ -345,8 +345,11 @@
$this->stack = &PEAR_ErrorStack::singleton('LiveUser');
if ($debug) {
- $this->log =& LiveUser::PEARLogFactory($debug);
- $this->stack->setLogger($this->log);
+ $log =& LiveUser::PEARLogFactory($debug);
+ if ($log) {
+ $this->log =& $log;
+ $this->stack->setLogger($this->log);
+ }
}
$this->stack->setErrorMessageTemplate($this->_errorMessages);
@@ -756,6 +759,14 @@
if (!is_object($log)) {
require_once 'Log.php';
$log =& Log::factory('composite');
+ if (!is_a($log, 'Log_composite')) {
+ $this->stack->push(
+ LIVEUSER_ERROR_CONFIG, 'exception', array(),
+ 'Could not create Log instance'
+ );
+ $return = false;
+ return $return;
+ }
$conf = array('colors' =>
array(
PEAR_LOG_EMERG => 'red',
@@ -769,6 +780,14 @@
),
);
$winlog =& Log::factory('win', 'LiveUser',
'LiveUser', $conf);
+ if (!is_a($winlog, 'Log_win')) {
+ $this->stack->push(
+ LIVEUSER_ERROR_CONFIG, 'exception', array(),
+ 'Could not create Log "window" instance'
+ );
+ $return = false;
+ return $return;
+ }
$log->addChild($winlog);
}