--- a/web/lib/Zend/Log/Formatter/Simple.php Thu Mar 21 17:31:31 2013 +0100
+++ b/web/lib/Zend/Log/Formatter/Simple.php Thu Mar 21 19:50:53 2013 +0100
@@ -15,23 +15,23 @@
* @category Zend
* @package Zend_Log
* @subpackage Formatter
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Simple.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @version $Id: Simple.php 24593 2012-01-05 20:35:02Z matthew $
*/
-/** Zend_Log_Formatter_Interface */
-require_once 'Zend/Log/Formatter/Interface.php';
+/** Zend_Log_Formatter_Abstract */
+require_once 'Zend/Log/Formatter/Abstract.php';
/**
* @category Zend
* @package Zend_Log
* @subpackage Formatter
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Simple.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @version $Id: Simple.php 24593 2012-01-05 20:35:02Z matthew $
*/
-class Zend_Log_Formatter_Simple implements Zend_Log_Formatter_Interface
+class Zend_Log_Formatter_Simple extends Zend_Log_Formatter_Abstract
{
/**
* @var string
@@ -44,6 +44,7 @@
* Class constructor
*
* @param null|string $format Format specifier for log messages
+ * @return void
* @throws Zend_Log_Exception
*/
public function __construct($format = null)
@@ -52,7 +53,7 @@
$format = self::DEFAULT_FORMAT . PHP_EOL;
}
- if (! is_string($format)) {
+ if (!is_string($format)) {
require_once 'Zend/Log/Exception.php';
throw new Zend_Log_Exception('Format must be a string');
}
@@ -61,6 +62,28 @@
}
/**
+ * Factory for Zend_Log_Formatter_Simple classe
+ *
+ * @param array|Zend_Config $options
+ * @return Zend_Log_Formatter_Simple
+ */
+ public static function factory($options)
+ {
+ $format = null;
+ if (null !== $options) {
+ if ($options instanceof Zend_Config) {
+ $options = $options->toArray();
+ }
+
+ if (array_key_exists('format', $options)) {
+ $format = $options['format'];
+ }
+ }
+
+ return new self($format);
+ }
+
+ /**
* Formats data into a single line to be written by the writer.
*
* @param array $event event data
@@ -69,17 +92,17 @@
public function format($event)
{
$output = $this->_format;
+
foreach ($event as $name => $value) {
-
if ((is_object($value) && !method_exists($value,'__toString'))
- || is_array($value)) {
-
+ || is_array($value)
+ ) {
$value = gettype($value);
}
$output = str_replace("%$name%", $value, $output);
}
+
return $output;
}
-
-}
+}
\ No newline at end of file