diff options
author | robocoder <anthon.pang@gmail.com> | 2009-09-07 22:40:52 +0400 |
---|---|---|
committer | robocoder <anthon.pang@gmail.com> | 2009-09-07 22:40:52 +0400 |
commit | ada0ccf4ecfd94428d0b2a74ea85607722989aaa (patch) | |
tree | b205427c2cbb4c03d741b62ed6cd64f763a99bef /libs/Zend/Log/Formatter/Simple.php | |
parent | 6392a745552a8804197385f6512d707c40c50feb (diff) |
Fixes #497 - update to Zend Framework 1.9.2 (subset); remove svn:keywords to preserve the original $Id; misc changes to handle fetchRow() sometimes returning null (instead of false)
git-svn-id: http://dev.piwik.org/svn/trunk@1454 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'libs/Zend/Log/Formatter/Simple.php')
-rw-r--r-- | libs/Zend/Log/Formatter/Simple.php | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/libs/Zend/Log/Formatter/Simple.php b/libs/Zend/Log/Formatter/Simple.php index cf0276c8ef..0761404742 100644 --- a/libs/Zend/Log/Formatter/Simple.php +++ b/libs/Zend/Log/Formatter/Simple.php @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Log * @subpackage Formatter - * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: Simple.php 16219 2009-06-21 19:45:39Z thomas $ */ /** Zend_Log_Formatter_Interface */ @@ -27,10 +27,10 @@ require_once 'Zend/Log/Formatter/Interface.php'; * @category Zend * @package Zend_Log * @subpackage Formatter - * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ - */ + * @version $Id: Simple.php 16219 2009-06-21 19:45:39Z thomas $ + */ class Zend_Log_Formatter_Simple implements Zend_Log_Formatter_Interface { /** @@ -38,6 +38,8 @@ class Zend_Log_Formatter_Simple implements Zend_Log_Formatter_Interface */ protected $_format; + const DEFAULT_FORMAT = '%timestamp% %priorityName% (%priority%): %message%'; + /** * Class constructor * @@ -47,13 +49,14 @@ class Zend_Log_Formatter_Simple implements Zend_Log_Formatter_Interface public function __construct($format = null) { if ($format === null) { - $format = '%timestamp% %priorityName% (%priority%): %message%' . PHP_EOL; + $format = self::DEFAULT_FORMAT . PHP_EOL; } - + if (! is_string($format)) { + require_once 'Zend/Log/Exception.php'; throw new Zend_Log_Exception('Format must be a string'); } - + $this->_format = $format; } @@ -67,6 +70,13 @@ class Zend_Log_Formatter_Simple implements Zend_Log_Formatter_Interface { $output = $this->_format; foreach ($event as $name => $value) { + + if ((is_object($value) && !method_exists($value,'__toString')) + || is_array($value)) { + + $value = gettype($value); + } + $output = str_replace("%$name%", $value, $output); } return $output; |