Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrobocoder <anthon.pang@gmail.com>2011-02-01 21:34:57 +0300
committerrobocoder <anthon.pang@gmail.com>2011-02-01 21:34:57 +0300
commitba5a93db097fc6481b9075927612f6f6cab6a9c3 (patch)
treef5422bbbc407031fd9feef83cdac2946db5035db /libs/Zend/Log
parent92f40ce16ce607291eb40193fe66c1b0f0606891 (diff)
fixes #1765
git-svn-id: http://dev.piwik.org/svn/trunk@3831 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'libs/Zend/Log')
-rw-r--r--libs/Zend/Log/FactoryInterface.php8
-rw-r--r--libs/Zend/Log/Formatter/Abstract.php40
-rw-r--r--libs/Zend/Log/Formatter/Firebug.php21
-rw-r--r--libs/Zend/Log/Formatter/Simple.php44
-rw-r--r--libs/Zend/Log/Formatter/Xml.php66
-rw-r--r--libs/Zend/Log/Writer/Db.php6
-rw-r--r--libs/Zend/Log/Writer/Stream.php4
-rw-r--r--libs/Zend/Log/Writer/Syslog.php11
8 files changed, 158 insertions, 42 deletions
diff --git a/libs/Zend/Log/FactoryInterface.php b/libs/Zend/Log/FactoryInterface.php
index ea988826c2..fa951b1d4e 100644
--- a/libs/Zend/Log/FactoryInterface.php
+++ b/libs/Zend/Log/FactoryInterface.php
@@ -16,7 +16,7 @@
* @package Zend_Log
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: FactoryInterface.php 23484 2010-12-10 03:57:59Z mjh_ca $
+ * @version $Id: FactoryInterface.php 23647 2011-01-21 18:54:14Z intiilapa $
*/
/**
@@ -24,15 +24,15 @@
* @package Zend_Log
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: FactoryInterface.php 23484 2010-12-10 03:57:59Z mjh_ca $
+ * @version $Id: FactoryInterface.php 23647 2011-01-21 18:54:14Z intiilapa $
*/
interface Zend_Log_FactoryInterface
{
/**
* Construct a Zend_Log driver
*
- * @param array|Zen_Config $config
+ * @param array|Zend_Config $config
* @return Zend_Log_FactoryInterface
*/
static public function factory($config);
-}
+} \ No newline at end of file
diff --git a/libs/Zend/Log/Formatter/Abstract.php b/libs/Zend/Log/Formatter/Abstract.php
new file mode 100644
index 0000000000..deaca3ce12
--- /dev/null
+++ b/libs/Zend/Log/Formatter/Abstract.php
@@ -0,0 +1,40 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Log
+ * @subpackage Formatter
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id: Abstract.php 23648 2011-01-21 19:04:20Z intiilapa $
+ */
+
+/** @see Zend_Log_Formatter_Interface */
+// require_once 'Zend/Log/Formatter/Interface.php';
+
+/** @see Zend_Log_FactoryInterface */
+// require_once 'Zend/Log/FactoryInterface.php';
+
+/**
+ * @category Zend
+ * @package Zend_Log
+ * @subpackage Formatter
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id: Abstract.php 23648 2011-01-21 19:04:20Z intiilapa $
+ */
+abstract class Zend_Log_Formatter_Abstract
+ implements Zend_Log_Formatter_Interface, Zend_Log_FactoryInterface
+{
+} \ No newline at end of file
diff --git a/libs/Zend/Log/Formatter/Firebug.php b/libs/Zend/Log/Formatter/Firebug.php
index a0238935ec..794f6f3c66 100644
--- a/libs/Zend/Log/Formatter/Firebug.php
+++ b/libs/Zend/Log/Formatter/Firebug.php
@@ -17,11 +17,11 @@
* @subpackage Formatter
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Firebug.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @version $Id: Firebug.php 23648 2011-01-21 19:04:20Z intiilapa $
*/
-/** Zend_Log_Formatter_Interface */
-// require_once 'Zend/Log/Formatter/Interface.php';
+/** Zend_Log_Formatter_Abstract */
+// require_once 'Zend/Log/Formatter/Abstract.php';
/**
* @category Zend
@@ -30,9 +30,20 @@
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
-class Zend_Log_Formatter_Firebug implements Zend_Log_Formatter_Interface
+class Zend_Log_Formatter_Firebug extends Zend_Log_Formatter_Abstract
{
/**
+ * Factory for Zend_Log_Formatter_Firebug classe
+ *
+ * @param array|Zend_Config $options useless
+ * @return Zend_Log_Formatter_Firebug
+ */
+ public static function factory($options)
+ {
+ return new self;
+ }
+
+ /**
* This method formats the event for the firebug writer.
*
* The default is to just send the message parameter, but through
@@ -47,4 +58,4 @@ class Zend_Log_Formatter_Firebug implements Zend_Log_Formatter_Interface
{
return $event['message'];
}
-}
+} \ No newline at end of file
diff --git a/libs/Zend/Log/Formatter/Simple.php b/libs/Zend/Log/Formatter/Simple.php
index 3e8aa5f208..207bcda1f7 100644
--- a/libs/Zend/Log/Formatter/Simple.php
+++ b/libs/Zend/Log/Formatter/Simple.php
@@ -17,11 +17,11 @@
* @subpackage Formatter
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Simple.php 23576 2010-12-23 23:25:44Z ramon $
+ * @version $Id: Simple.php 23648 2011-01-21 19:04:20Z intiilapa $
*/
-/** Zend_Log_Formatter_Interface */
-// require_once 'Zend/Log/Formatter/Interface.php';
+/** Zend_Log_Formatter_Abstract */
+// require_once 'Zend/Log/Formatter/Abstract.php';
/**
* @category Zend
@@ -29,9 +29,9 @@
* @subpackage Formatter
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Simple.php 23576 2010-12-23 23:25:44Z ramon $
+ * @version $Id: Simple.php 23648 2011-01-21 19:04:20Z intiilapa $
*/
-class Zend_Log_Formatter_Simple implements Zend_Log_Formatter_Interface
+class Zend_Log_Formatter_Simple extends Zend_Log_Formatter_Abstract
{
/**
* @var string
@@ -53,7 +53,7 @@ class Zend_Log_Formatter_Simple implements Zend_Log_Formatter_Interface
$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');
}
@@ -62,6 +62,28 @@ class Zend_Log_Formatter_Simple implements Zend_Log_Formatter_Interface
}
/**
+ * 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
@@ -70,17 +92,17 @@ class Zend_Log_Formatter_Simple implements Zend_Log_Formatter_Interface
public function format($event)
{
$output = $this->_format;
- foreach ($event as $name => $value) {
+ 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
diff --git a/libs/Zend/Log/Formatter/Xml.php b/libs/Zend/Log/Formatter/Xml.php
index 8940473f09..5a3e4fbdad 100644
--- a/libs/Zend/Log/Formatter/Xml.php
+++ b/libs/Zend/Log/Formatter/Xml.php
@@ -17,11 +17,11 @@
* @subpackage Formatter
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Xml.php 23576 2010-12-23 23:25:44Z ramon $
+ * @version $Id: Xml.php 23648 2011-01-21 19:04:20Z intiilapa $
*/
-/** Zend_Log_Formatter_Interface */
-// require_once 'Zend/Log/Formatter/Interface.php';
+/** Zend_Log_Formatter_Abstract */
+// require_once 'Zend/Log/Formatter/Abstract.php';
/**
* @category Zend
@@ -29,9 +29,9 @@
* @subpackage Formatter
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Xml.php 23576 2010-12-23 23:25:44Z ramon $
+ * @version $Id: Xml.php 23648 2011-01-21 19:04:20Z intiilapa $
*/
-class Zend_Log_Formatter_Xml implements Zend_Log_Formatter_Interface
+class Zend_Log_Formatter_Xml extends Zend_Log_Formatter_Abstract
{
/**
* @var string Name of root element
@@ -50,17 +50,56 @@ class Zend_Log_Formatter_Xml implements Zend_Log_Formatter_Interface
/**
* Class constructor
+ * (the default encoding is UTF-8)
*
- * @param string $rootElement Name of root element
- * @param array $elementMap Relates XML elements to log data field keys
- * @param string $encoding Encoding to use (defaults to UTF-8)
+ * @param array|Zend_Config $options
* @return void
*/
- public function __construct($rootElement = 'logEntry', $elementMap = null, $encoding = 'UTF-8')
+ public function __construct($options = array())
{
- $this->_rootElement = $rootElement;
- $this->_elementMap = $elementMap;
- $this->setEncoding($encoding);
+ if ($options instanceof Zend_Config) {
+ $options = $options->toArray();
+ } elseif (!is_array($options)) {
+ $args = func_get_args();
+
+ $options = array(
+ 'rootElement' => array_shift($args)
+ );
+
+ if (count($args)) {
+ $options['elementMap'] = array_shift($args);
+ }
+
+ if (count($args)) {
+ $options['encoding'] = array_shift($args);
+ }
+ }
+
+ if (!array_key_exists('rootElement', $options)) {
+ $options['rootElement'] = 'logEntry';
+ }
+
+ if (!array_key_exists('encoding', $options)) {
+ $options['encoding'] = 'UTF-8';
+ }
+
+ $this->_rootElement = $options['rootElement'];
+ $this->setEncoding($options['encoding']);
+
+ if (array_key_exists('elementMap', $options)) {
+ $this->_elementMap = $options['elementMap'];
+ }
+ }
+
+ /**
+ * Factory for Zend_Log_Formatter_Xml classe
+ *
+ * @param array|Zend_Config $options
+ * @return Zend_Log_Formatter_Xml
+ */
+ public static function factory($options)
+ {
+ return new self($options);
}
/**
@@ -118,5 +157,4 @@ class Zend_Log_Formatter_Xml implements Zend_Log_Formatter_Interface
return $xml . PHP_EOL;
}
-
-}
+} \ No newline at end of file
diff --git a/libs/Zend/Log/Writer/Db.php b/libs/Zend/Log/Writer/Db.php
index 47217052d6..3d6fa8c45e 100644
--- a/libs/Zend/Log/Writer/Db.php
+++ b/libs/Zend/Log/Writer/Db.php
@@ -17,7 +17,7 @@
* @subpackage Writer
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Db.php 23576 2010-12-23 23:25:44Z ramon $
+ * @version $Id: Db.php 23601 2011-01-01 15:43:07Z ramon $
*/
/** Zend_Log_Writer_Abstract */
@@ -29,7 +29,7 @@
* @subpackage Writer
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Db.php 23576 2010-12-23 23:25:44Z ramon $
+ * @version $Id: Db.php 23601 2011-01-01 15:43:07Z ramon $
*/
class Zend_Log_Writer_Db extends Zend_Log_Writer_Abstract
{
@@ -74,7 +74,6 @@ class Zend_Log_Writer_Db extends Zend_Log_Writer_Abstract
*
* @param array|Zend_Config $config
* @return Zend_Log_Writer_Db
- * @throws Zend_Log_Exception
*/
static public function factory($config)
{
@@ -123,6 +122,7 @@ class Zend_Log_Writer_Db extends Zend_Log_Writer_Abstract
*
* @param array $event event data
* @return void
+ * @throws Zend_Log_Exception
*/
protected function _write($event)
{
diff --git a/libs/Zend/Log/Writer/Stream.php b/libs/Zend/Log/Writer/Stream.php
index 25d6d75892..e07b278b28 100644
--- a/libs/Zend/Log/Writer/Stream.php
+++ b/libs/Zend/Log/Writer/Stream.php
@@ -17,7 +17,7 @@
* @subpackage Writer
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Stream.php 23584 2010-12-28 19:51:49Z matthew $
+ * @version $Id: Stream.php 23588 2010-12-28 23:06:39Z matthew $
*/
/** Zend_Log_Writer_Abstract */
@@ -32,7 +32,7 @@
* @subpackage Writer
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Stream.php 23584 2010-12-28 19:51:49Z matthew $
+ * @version $Id: Stream.php 23588 2010-12-28 23:06:39Z matthew $
*/
class Zend_Log_Writer_Stream extends Zend_Log_Writer_Abstract
{
diff --git a/libs/Zend/Log/Writer/Syslog.php b/libs/Zend/Log/Writer/Syslog.php
index 0ac5a5690a..3e80bb153d 100644
--- a/libs/Zend/Log/Writer/Syslog.php
+++ b/libs/Zend/Log/Writer/Syslog.php
@@ -17,7 +17,7 @@
* @subpackage Writer
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Syslog.php 23576 2010-12-23 23:25:44Z ramon $
+ * @version $Id: Syslog.php 23595 2010-12-30 10:09:31Z intiilapa $
*/
/** Zend_Log */
@@ -257,6 +257,11 @@ class Zend_Log_Writer_Syslog extends Zend_Log_Writer_Abstract
$this->_initializeSyslog();
}
- syslog($priority, $event['message']);
+ $message = $event['message'];
+ if ($this->_formatter instanceof Zend_Log_Formatter_Interface) {
+ $message = $this->_formatter->format($event);
+ }
+
+ syslog($priority, $message);
}
-}
+} \ No newline at end of file