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:
Diffstat (limited to 'libs/Zend/Log')
-rw-r--r--libs/Zend/Log/Exception.php8
-rw-r--r--libs/Zend/Log/FactoryInterface.php38
-rw-r--r--libs/Zend/Log/Filter/Abstract.php60
-rw-r--r--libs/Zend/Log/Filter/Interface.php9
-rw-r--r--libs/Zend/Log/Filter/Message.php30
-rw-r--r--libs/Zend/Log/Filter/Priority.php45
-rw-r--r--libs/Zend/Log/Filter/Suppress.php21
-rw-r--r--libs/Zend/Log/Formatter/Firebug.php6
-rw-r--r--libs/Zend/Log/Formatter/Interface.php8
-rw-r--r--libs/Zend/Log/Formatter/Simple.php8
-rw-r--r--libs/Zend/Log/Formatter/Xml.php8
-rw-r--r--libs/Zend/Log/Writer/Abstract.php34
-rw-r--r--libs/Zend/Log/Writer/Db.php36
-rw-r--r--libs/Zend/Log/Writer/Firebug.php20
-rw-r--r--libs/Zend/Log/Writer/Mail.php20
-rw-r--r--libs/Zend/Log/Writer/Mock.php22
-rw-r--r--libs/Zend/Log/Writer/Null.php23
-rw-r--r--libs/Zend/Log/Writer/Stream.php43
-rw-r--r--libs/Zend/Log/Writer/Syslog.php18
-rw-r--r--libs/Zend/Log/Writer/ZendMonitor.php111
20 files changed, 484 insertions, 84 deletions
diff --git a/libs/Zend/Log/Exception.php b/libs/Zend/Log/Exception.php
index 4290898cdd..08557db8fb 100644
--- a/libs/Zend/Log/Exception.php
+++ b/libs/Zend/Log/Exception.php
@@ -14,9 +14,9 @@
*
* @category Zend
* @package Zend_Log
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @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: Exception.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** Zend_Exception */
@@ -25,9 +25,9 @@ require_once 'Zend/Exception.php';
/**
* @category Zend
* @package Zend_Log
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @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: Exception.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
class Zend_Log_Exception extends Zend_Exception
{}
diff --git a/libs/Zend/Log/FactoryInterface.php b/libs/Zend/Log/FactoryInterface.php
new file mode 100644
index 0000000000..20a270747f
--- /dev/null
+++ b/libs/Zend/Log/FactoryInterface.php
@@ -0,0 +1,38 @@
+<?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
+ * @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$
+ */
+
+/**
+ * @category Zend
+ * @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$
+ */
+interface Zend_Log_FactoryInterface
+{
+ /**
+ * Construct a Zend_Log driver
+ *
+ * @param array|Zen_Config $config
+ * @return Zend_Log_FactoryInterface
+ */
+ static public function factory($config);
+}
diff --git a/libs/Zend/Log/Filter/Abstract.php b/libs/Zend/Log/Filter/Abstract.php
new file mode 100644
index 0000000000..8253c3b98a
--- /dev/null
+++ b/libs/Zend/Log/Filter/Abstract.php
@@ -0,0 +1,60 @@
+<?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 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$
+ */
+
+/** @see Zend_Log_Filter_Interface */
+require_once 'Zend/Log/Filter/Interface.php';
+
+/** @see Zend_Log_FactoryInterface */
+require_once 'Zend/Log/FactoryInterface.php';
+
+/**
+ * @category Zend
+ * @package Zend_Log
+ * @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$
+ */
+abstract class Zend_Log_Filter_Abstract
+ implements Zend_Log_Filter_Interface, Zend_Log_FactoryInterface
+{
+ /**
+ * Validate and optionally convert the config to array
+ *
+ * @param array|Zend_Config $config Zend_Config or Array
+ * @return array
+ * @throws Zend_Log_Exception
+ */
+ static protected function _parseConfig($config)
+ {
+ if ($config instanceof Zend_Config) {
+ $config = $config->asArray();
+ }
+
+ if (!is_array($config)) {
+ require_once 'Zend/Log/Exception.php';
+ throw new Zend_Log_Exception('Configuration must be an array or instance of Zend_Config');
+ }
+
+ return $config;
+ }
+}
diff --git a/libs/Zend/Log/Filter/Interface.php b/libs/Zend/Log/Filter/Interface.php
index 104b578f91..c2165d2ba6 100644
--- a/libs/Zend/Log/Filter/Interface.php
+++ b/libs/Zend/Log/Filter/Interface.php
@@ -15,18 +15,18 @@
* @category Zend
* @package Zend_Log
* @subpackage Filter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @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: Interface.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Interface.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @category Zend
* @package Zend_Log
* @subpackage Filter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @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: Interface.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Interface.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
interface Zend_Log_Filter_Interface
{
@@ -37,5 +37,4 @@ interface Zend_Log_Filter_Interface
* @return boolean accepted?
*/
public function accept($event);
-
}
diff --git a/libs/Zend/Log/Filter/Message.php b/libs/Zend/Log/Filter/Message.php
index 9a05deaedf..5797a19be0 100644
--- a/libs/Zend/Log/Filter/Message.php
+++ b/libs/Zend/Log/Filter/Message.php
@@ -15,9 +15,9 @@
* @category Zend
* @package Zend_Log
* @subpackage Filter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @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: Message.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Message.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** Zend_Log_Filter_Interface */
@@ -27,11 +27,11 @@ require_once 'Zend/Log/Filter/Interface.php';
* @category Zend
* @package Zend_Log
* @subpackage Filter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @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: Message.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Message.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
-class Zend_Log_Filter_Message implements Zend_Log_Filter_Interface
+class Zend_Log_Filter_Message extends Zend_Log_Filter_Abstract
{
/**
* @var string
@@ -54,6 +54,25 @@ class Zend_Log_Filter_Message implements Zend_Log_Filter_Interface
}
/**
+ * Create a new instance of Zend_Log_Filter_Message
+ *
+ * @param array|Zend_Config $config
+ * @return Zend_Log_Filter_Message
+ * @throws Zend_Log_Exception
+ */
+ static public function factory($config)
+ {
+ $config = self::_parseConfig($config);
+ $config = array_merge(array(
+ 'regexp' => null
+ ), $config);
+
+ return new self(
+ $config['regexp']
+ );
+ }
+
+ /**
* Returns TRUE to accept the message, FALSE to block it.
*
* @param array $event event data
@@ -63,5 +82,4 @@ class Zend_Log_Filter_Message implements Zend_Log_Filter_Interface
{
return preg_match($this->_regexp, $event['message']) > 0;
}
-
}
diff --git a/libs/Zend/Log/Filter/Priority.php b/libs/Zend/Log/Filter/Priority.php
index d19c3f9ec6..1835c9a299 100644
--- a/libs/Zend/Log/Filter/Priority.php
+++ b/libs/Zend/Log/Filter/Priority.php
@@ -15,23 +15,23 @@
* @category Zend
* @package Zend_Log
* @subpackage Filter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @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: Priority.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Priority.php 20260 2010-01-13 18:29:22Z ralph $
*/
-/** Zend_Log_Filter_Interface */
-require_once 'Zend/Log/Filter/Interface.php';
+/** Zend_Log_Filter_Abstract */
+require_once 'Zend/Log/Filter/Abstract.php';
/**
* @category Zend
* @package Zend_Log
* @subpackage Filter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @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: Priority.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Priority.php 20260 2010-01-13 18:29:22Z ralph $
*/
-class Zend_Log_Filter_Priority implements Zend_Log_Filter_Interface
+class Zend_Log_Filter_Priority extends Zend_Log_Filter_Abstract
{
/**
* @var integer
@@ -51,7 +51,7 @@ class Zend_Log_Filter_Priority implements Zend_Log_Filter_Interface
* @param string $operator Comparison operator
* @throws Zend_Log_Exception
*/
- public function __construct($priority, $operator = '<=')
+ public function __construct($priority, $operator = NULL)
{
if (! is_integer($priority)) {
require_once 'Zend/Log/Exception.php';
@@ -59,7 +59,33 @@ class Zend_Log_Filter_Priority implements Zend_Log_Filter_Interface
}
$this->_priority = $priority;
- $this->_operator = $operator;
+ $this->_operator = is_null($operator) ? '<=' : $operator;
+ }
+
+ /**
+ * Create a new instance of Zend_Log_Filter_Priority
+ *
+ * @param array|Zend_Config $config
+ * @return Zend_Log_Filter_Priority
+ * @throws Zend_Log_Exception
+ */
+ static public function factory($config)
+ {
+ $config = self::_parseConfig($config);
+ $config = array_merge(array(
+ 'priority' => null,
+ 'operator' => null,
+ ), $config);
+
+ // Add support for constants
+ if (!is_numeric($config['priority']) && isset($config['priority']) && defined($config['priority'])) {
+ $config['priority'] = constant($config['priority']);
+ }
+
+ return new self(
+ (int) $config['priority'],
+ $config['operator']
+ );
}
/**
@@ -72,5 +98,4 @@ class Zend_Log_Filter_Priority implements Zend_Log_Filter_Interface
{
return version_compare($event['priority'], $this->_priority, $this->_operator);
}
-
}
diff --git a/libs/Zend/Log/Filter/Suppress.php b/libs/Zend/Log/Filter/Suppress.php
index 026db36727..14b74ae603 100644
--- a/libs/Zend/Log/Filter/Suppress.php
+++ b/libs/Zend/Log/Filter/Suppress.php
@@ -15,9 +15,9 @@
* @category Zend
* @package Zend_Log
* @subpackage Filter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @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: Suppress.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Suppress.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** Zend_Log_Filter_Interface */
@@ -27,11 +27,11 @@ require_once 'Zend/Log/Filter/Interface.php';
* @category Zend
* @package Zend_Log
* @subpackage Filter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @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: Suppress.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Suppress.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
-class Zend_Log_Filter_Suppress implements Zend_Log_Filter_Interface
+class Zend_Log_Filter_Suppress extends Zend_Log_Filter_Abstract
{
/**
* @var boolean
@@ -63,4 +63,15 @@ class Zend_Log_Filter_Suppress implements Zend_Log_Filter_Interface
return $this->_accept;
}
+ /**
+ * Create a new instance of Zend_Log_Filter_Suppress
+ *
+ * @param array|Zend_Config $config
+ * @return Zend_Log_Filter_Suppress
+ * @throws Zend_Log_Exception
+ */
+ static public function factory($config)
+ {
+ return new self();
+ }
}
diff --git a/libs/Zend/Log/Formatter/Firebug.php b/libs/Zend/Log/Formatter/Firebug.php
index a5a672e04a..ef155a5999 100644
--- a/libs/Zend/Log/Formatter/Firebug.php
+++ b/libs/Zend/Log/Formatter/Firebug.php
@@ -15,9 +15,9 @@
* @category Zend
* @package Zend_Log
* @subpackage Formatter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @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 18951 2009-11-12 16:26:19Z alexander $
+ * @version $Id: Firebug.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** Zend_Log_Formatter_Interface */
@@ -27,7 +27,7 @@ require_once 'Zend/Log/Formatter/Interface.php';
* @category Zend
* @package Zend_Log
* @subpackage Formatter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @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
diff --git a/libs/Zend/Log/Formatter/Interface.php b/libs/Zend/Log/Formatter/Interface.php
index 000734f393..2d05145a3f 100644
--- a/libs/Zend/Log/Formatter/Interface.php
+++ b/libs/Zend/Log/Formatter/Interface.php
@@ -15,18 +15,18 @@
* @category Zend
* @package Zend_Log
* @subpackage Formatter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @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: Interface.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Interface.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @category Zend
* @package Zend_Log
* @subpackage Formatter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @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: Interface.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Interface.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
interface Zend_Log_Formatter_Interface
{
diff --git a/libs/Zend/Log/Formatter/Simple.php b/libs/Zend/Log/Formatter/Simple.php
index 0761404742..c53b7c0d60 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-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @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 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Simple.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** Zend_Log_Formatter_Interface */
@@ -27,9 +27,9 @@ require_once 'Zend/Log/Formatter/Interface.php';
* @category Zend
* @package Zend_Log
* @subpackage Formatter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @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 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Simple.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
class Zend_Log_Formatter_Simple implements Zend_Log_Formatter_Interface
{
diff --git a/libs/Zend/Log/Formatter/Xml.php b/libs/Zend/Log/Formatter/Xml.php
index 76f6da516e..a0af504bc2 100644
--- a/libs/Zend/Log/Formatter/Xml.php
+++ b/libs/Zend/Log/Formatter/Xml.php
@@ -15,9 +15,9 @@
* @category Zend
* @package Zend_Log
* @subpackage Formatter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @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 20105 2010-01-06 21:28:26Z matthew $
+ * @version $Id: Xml.php 20104 2010-01-06 21:26:01Z matthew $
*/
/** Zend_Log_Formatter_Interface */
@@ -27,9 +27,9 @@ require_once 'Zend/Log/Formatter/Interface.php';
* @category Zend
* @package Zend_Log
* @subpackage Formatter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @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 20105 2010-01-06 21:28:26Z matthew $
+ * @version $Id: Xml.php 20104 2010-01-06 21:26:01Z matthew $
*/
class Zend_Log_Formatter_Xml implements Zend_Log_Formatter_Interface
{
diff --git a/libs/Zend/Log/Writer/Abstract.php b/libs/Zend/Log/Writer/Abstract.php
index 3e3be2d6cd..979375a83f 100644
--- a/libs/Zend/Log/Writer/Abstract.php
+++ b/libs/Zend/Log/Writer/Abstract.php
@@ -15,9 +15,9 @@
* @category Zend
* @package Zend_Log
* @subpackage Writer
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @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 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Abstract.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** Zend_Log_Filter_Priority */
@@ -27,11 +27,11 @@ require_once 'Zend/Log/Filter/Priority.php';
* @category Zend
* @package Zend_Log
* @subpackage Writer
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @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 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Abstract.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
-abstract class Zend_Log_Writer_Abstract
+abstract class Zend_Log_Writer_Abstract implements Zend_Log_FactoryInterface
{
/**
* @var array of Zend_Log_Filter_Interface
@@ -104,4 +104,26 @@ abstract class Zend_Log_Writer_Abstract
*/
abstract protected function _write($event);
-} \ No newline at end of file
+ /**
+ * Validate and optionally convert the config to array
+ *
+ * @param array|Zend_Config $config Zend_Config or Array
+ * @return array
+ * @throws Zend_Log_Exception
+ */
+ static protected function _parseConfig($config)
+ {
+ if ($config instanceof Zend_Config) {
+ $config = $config->toArray();
+ }
+
+ if (!is_array($config)) {
+ require_once 'Zend/Log/Exception.php';
+ throw new Zend_Log_Exception(
+ 'Configuration must be an array or instance of Zend_Config'
+ );
+ }
+
+ return $config;
+ }
+}
diff --git a/libs/Zend/Log/Writer/Db.php b/libs/Zend/Log/Writer/Db.php
index 2130efe28e..63660aec6f 100644
--- a/libs/Zend/Log/Writer/Db.php
+++ b/libs/Zend/Log/Writer/Db.php
@@ -15,9 +15,9 @@
* @category Zend
* @package Zend_Log
* @subpackage Writer
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @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 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Db.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** Zend_Log_Writer_Abstract */
@@ -27,9 +27,9 @@ require_once 'Zend/Log/Writer/Abstract.php';
* @category Zend
* @package Zend_Log
* @subpackage Writer
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @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 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Db.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
class Zend_Log_Writer_Db extends Zend_Log_Writer_Abstract
{
@@ -67,6 +67,33 @@ class Zend_Log_Writer_Db extends Zend_Log_Writer_Abstract
}
/**
+ * Create a new instance of Zend_Log_Writer_Db
+ *
+ * @param array|Zend_Config $config
+ * @return Zend_Log_Writer_Db
+ * @throws Zend_Log_Exception
+ */
+ static public function factory($config)
+ {
+ $config = self::_parseConfig($config);
+ $config = array_merge(array(
+ 'db' => null,
+ 'table' => null,
+ 'columnMap' => null,
+ ), $config);
+
+ if (isset($config['columnmap'])) {
+ $config['columnMap'] = $config['columnmap'];
+ }
+
+ return new self(
+ $config['db'],
+ $config['table'],
+ $config['columnMap']
+ );
+ }
+
+ /**
* Formatting is not possible on this writer
*/
public function setFormatter($formatter)
@@ -109,5 +136,4 @@ class Zend_Log_Writer_Db extends Zend_Log_Writer_Abstract
$this->_db->insert($this->_table, $dataToInsert);
}
-
}
diff --git a/libs/Zend/Log/Writer/Firebug.php b/libs/Zend/Log/Writer/Firebug.php
index 54616d5009..5afd752401 100644
--- a/libs/Zend/Log/Writer/Firebug.php
+++ b/libs/Zend/Log/Writer/Firebug.php
@@ -15,9 +15,9 @@
* @category Zend
* @package Zend_Log
* @subpackage Writer
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @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 18951 2009-11-12 16:26:19Z alexander $
+ * @version $Id: Firebug.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** Zend_Log */
@@ -38,7 +38,7 @@ require_once 'Zend/Wildfire/Plugin/FirePhp.php';
* @category Zend
* @package Zend_Log
* @subpackage Writer
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @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_Writer_Firebug extends Zend_Log_Writer_Abstract
@@ -74,12 +74,24 @@ class Zend_Log_Writer_Firebug extends Zend_Log_Writer_Abstract
*/
public function __construct()
{
- if (php_sapi_name()=='cli') {
+ if (php_sapi_name() == 'cli') {
$this->setEnabled(false);
}
$this->_formatter = new Zend_Log_Formatter_Firebug();
}
+
+ /**
+ * Create a new instance of Zend_Log_Writer_Firebug
+ *
+ * @param array|Zend_Config $config
+ * @return Zend_Log_Writer_Firebug
+ * @throws Zend_Log_Exception
+ */
+ static public function factory($config)
+ {
+ return new self();
+ }
/**
* Enable or disable the log writer.
diff --git a/libs/Zend/Log/Writer/Mail.php b/libs/Zend/Log/Writer/Mail.php
index 068bd33dc1..2d47670e1d 100644
--- a/libs/Zend/Log/Writer/Mail.php
+++ b/libs/Zend/Log/Writer/Mail.php
@@ -15,9 +15,9 @@
* @category Zend
* @package Zend_Log
* @subpackage Writer
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @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: Mail.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Mail.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** Zend_Log_Writer_Abstract */
@@ -39,9 +39,9 @@ require_once 'Zend/Log/Formatter/Simple.php';
* @category Zend
* @package Zend_Log
* @subpackage Writer
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @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: Mail.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Mail.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
class Zend_Log_Writer_Mail extends Zend_Log_Writer_Abstract
{
@@ -117,6 +117,18 @@ class Zend_Log_Writer_Mail extends Zend_Log_Writer_Abstract
$this->_layout = $layout;
$this->_formatter = new Zend_Log_Formatter_Simple();
}
+
+ /**
+ * Create a new instance of Zend_Log_Writer_Mail
+ *
+ * @param array|Zend_Config $config
+ * @return Zend_Log_Writer_Mail
+ * @throws Zend_Log_Exception
+ */
+ static public function factory($config)
+ {
+ throw new Zend_Exception('Zend_Log_Writer_Mail does not currently implement a factory');
+ }
/**
* Places event line into array of lines to be used as message body.
diff --git a/libs/Zend/Log/Writer/Mock.php b/libs/Zend/Log/Writer/Mock.php
index 2a593c0d9e..f946219a9f 100644
--- a/libs/Zend/Log/Writer/Mock.php
+++ b/libs/Zend/Log/Writer/Mock.php
@@ -15,9 +15,9 @@
* @category Zend
* @package Zend_Log
* @subpackage Writer
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @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: Mock.php 16971 2009-07-22 18:05:45Z mikaelkael $
+ * @version $Id: Mock.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** Zend_Log_Writer_Abstract */
@@ -27,9 +27,9 @@ require_once 'Zend/Log/Writer/Abstract.php';
* @category Zend
* @package Zend_Log
* @subpackage Writer
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @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: Mock.php 16971 2009-07-22 18:05:45Z mikaelkael $
+ * @version $Id: Mock.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
class Zend_Log_Writer_Mock extends Zend_Log_Writer_Abstract
{
@@ -63,4 +63,16 @@ class Zend_Log_Writer_Mock extends Zend_Log_Writer_Abstract
{
$this->shutdown = true;
}
-} \ No newline at end of file
+
+ /**
+ * Create a new instance of Zend_Log_Writer_Mock
+ *
+ * @param array|Zend_Config $config
+ * @return Zend_Log_Writer_Mock
+ * @throws Zend_Log_Exception
+ */
+ static public function factory($config)
+ {
+ return new self();
+ }
+}
diff --git a/libs/Zend/Log/Writer/Null.php b/libs/Zend/Log/Writer/Null.php
index de791d3a99..d86b69b583 100644
--- a/libs/Zend/Log/Writer/Null.php
+++ b/libs/Zend/Log/Writer/Null.php
@@ -15,9 +15,9 @@
* @category Zend
* @package Zend_Log
* @subpackage Writer
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @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: Null.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Null.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** Zend_Log_Writer_Abstract */
@@ -27,9 +27,9 @@ require_once 'Zend/Log/Writer/Abstract.php';
* @category Zend
* @package Zend_Log
* @subpackage Writer
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @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: Null.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Null.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
class Zend_Log_Writer_Null extends Zend_Log_Writer_Abstract
{
@@ -42,5 +42,16 @@ class Zend_Log_Writer_Null extends Zend_Log_Writer_Abstract
protected function _write($event)
{
}
-
-} \ No newline at end of file
+
+ /**
+ * Create a new instance of Zend_Log_Writer_Null
+ *
+ * @param array|Zend_Config $config
+ * @return Zend_Log_Writer_Null
+ * @throws Zend_Log_Exception
+ */
+ static public function factory($config)
+ {
+ return new self();
+ }
+}
diff --git a/libs/Zend/Log/Writer/Stream.php b/libs/Zend/Log/Writer/Stream.php
index 99b050ad6b..fdf924efdc 100644
--- a/libs/Zend/Log/Writer/Stream.php
+++ b/libs/Zend/Log/Writer/Stream.php
@@ -15,9 +15,9 @@
* @category Zend
* @package Zend_Log
* @subpackage Writer
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @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 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Stream.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** Zend_Log_Writer_Abstract */
@@ -30,9 +30,9 @@ require_once 'Zend/Log/Formatter/Simple.php';
* @category Zend
* @package Zend_Log
* @subpackage Writer
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @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 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Stream.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
class Zend_Log_Writer_Stream extends Zend_Log_Writer_Abstract
{
@@ -48,8 +48,13 @@ class Zend_Log_Writer_Stream extends Zend_Log_Writer_Abstract
* @param streamOrUrl Stream or URL to open as a stream
* @param mode Mode, only applicable if a URL is given
*/
- public function __construct($streamOrUrl, $mode = 'a')
+ public function __construct($streamOrUrl, $mode = NULL)
{
+ // Setting the default
+ if ($mode === NULL) {
+ $mode = 'a';
+ }
+
if (is_resource($streamOrUrl)) {
if (get_resource_type($streamOrUrl) != 'stream') {
require_once 'Zend/Log/Exception.php';
@@ -63,6 +68,10 @@ class Zend_Log_Writer_Stream extends Zend_Log_Writer_Abstract
$this->_stream = $streamOrUrl;
} else {
+ if (is_array($streamOrUrl) && isset($streamOrUrl['stream'])) {
+ $streamOrUrl = $streamOrUrl['stream'];
+ }
+
if (! $this->_stream = @fopen($streamOrUrl, $mode, false)) {
require_once 'Zend/Log/Exception.php';
$msg = "\"$streamOrUrl\" cannot be opened with mode \"$mode\"";
@@ -72,7 +81,30 @@ class Zend_Log_Writer_Stream extends Zend_Log_Writer_Abstract
$this->_formatter = new Zend_Log_Formatter_Simple();
}
+
+ /**
+ * Create a new instance of Zend_Log_Writer_Mock
+ *
+ * @param array|Zend_Config $config
+ * @return Zend_Log_Writer_Mock
+ * @throws Zend_Log_Exception
+ */
+ static public function factory($config)
+ {
+ $config = self::_parseConfig($config);
+ $config = array_merge(array(
+ 'stream' => null,
+ 'mode' => null,
+ ), $config);
+ $streamOrUrl = isset($config['url']) ? $config['url'] : $config['stream'];
+
+ return new self(
+ $streamOrUrl,
+ $config['mode']
+ );
+ }
+
/**
* Close the stream resource.
*
@@ -100,5 +132,4 @@ class Zend_Log_Writer_Stream extends Zend_Log_Writer_Abstract
throw new Zend_Log_Exception("Unable to write to stream");
}
}
-
}
diff --git a/libs/Zend/Log/Writer/Syslog.php b/libs/Zend/Log/Writer/Syslog.php
index 3409ae56dc..96fbe56922 100644
--- a/libs/Zend/Log/Writer/Syslog.php
+++ b/libs/Zend/Log/Writer/Syslog.php
@@ -15,9 +15,9 @@
* @category Zend
* @package Zend_Log
* @subpackage Writer
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @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 16971 2009-07-22 18:05:45Z mikaelkael $
+ * @version $Id: Syslog.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** Zend_Log_Writer_Abstract */
@@ -29,7 +29,7 @@ require_once 'Zend/Log/Writer/Abstract.php';
* @category Zend
* @package Zend_Log
* @subpackage Writer
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @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_Writer_Syslog extends Zend_Log_Writer_Abstract
@@ -95,6 +95,18 @@ class Zend_Log_Writer_Syslog extends Zend_Log_Writer_Abstract
}
$this->_initializeSyslog();
}
+
+ /**
+ * Create a new instance of Zend_Log_Writer_Syslog
+ *
+ * @param array|Zend_Config $config
+ * @return Zend_Log_Writer_Syslog
+ * @throws Zend_Log_Exception
+ */
+ static public function factory($config)
+ {
+ return new self(self::_parseConfig($config));
+ }
/**
* Initialize syslog / set application name and facility
diff --git a/libs/Zend/Log/Writer/ZendMonitor.php b/libs/Zend/Log/Writer/ZendMonitor.php
new file mode 100644
index 0000000000..082f2a4f58
--- /dev/null
+++ b/libs/Zend/Log/Writer/ZendMonitor.php
@@ -0,0 +1,111 @@
+<?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 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$
+ */
+
+/** Zend_Log_Writer_Abstract */
+require_once 'Zend/Log/Writer/Abstract.php';
+
+/**
+ * @category Zend
+ * @package Zend_Log
+ * @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$
+ */
+class Zend_Log_Writer_ZendMonitor extends Zend_Log_Writer_Abstract
+{
+ /**
+ * Is Zend Monitor enabled?
+ * @var bool
+ */
+ protected $_isEnabled = true;
+
+ /**
+ * @throws Zend_Log_Exception if Zend Monitor extension not present
+ */
+ public function __construct()
+ {
+ if (!function_exists('monitor_custom_event')) {
+ $this->_isEnabled = false;
+ }
+ }
+
+ /**
+ * Create a new instance of Zend_Log_Writer_ZendMonitor
+ *
+ * @param array|Zend_Config $config
+ * @return Zend_Log_Writer_Syslog
+ * @throws Zend_Log_Exception
+ */
+ static public function factory($config)
+ {
+ return new self();
+ }
+
+ /**
+ * Is logging to this writer enabled?
+ *
+ * If the Zend Monitor extension is not enabled, this log writer will
+ * fail silently. You can query this method to determine if the log
+ * writer is enabled.
+ *
+ * @return bool
+ */
+ public function isEnabled()
+ {
+ return $this->_isEnabled;
+ }
+
+ /**
+ * Log a message to this writer.
+ *
+ * @param array $event log data event
+ * @return void
+ */
+ public function write($event)
+ {
+ if (!$this->isEnabled()) {
+ return;
+ }
+
+ parent::write($event);
+ }
+
+ /**
+ * Write a message to the log.
+ *
+ * @param array $event log data event
+ * @return void
+ */
+ protected function _write($event)
+ {
+ $priority = $event['priority'];
+ $message = $event['message'];
+ unset($event['priority'], $event['message']);
+
+ if (!empty($event)) {
+ monitor_custom_event($priority, $message, $event);
+ } else {
+ monitor_custom_event($priority, $message);
+ }
+ }
+}