7
* This source file is subject to the new BSD license that is bundled
8
* with this package in the file LICENSE.txt.
9
* It is also available through the world-wide-web at this URL:
10
* http://framework.zend.com/license/new-bsd
11
* If you did not receive a copy of the license and are unable to
12
* obtain it through the world-wide-web, please send an email
13
* to license@zend.com so we can send you a copy immediately.
18
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
19
* @license http://framework.zend.com/license/new-bsd New BSD License
20
* @version $Id: Priority.php 8064 2008-02-16 10:58:39Z thomas $
23
/** Zend_Log_Filter_Interface */
24
require_once 'Zend/Log/Filter/Interface.php';
30
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
31
* @license http://framework.zend.com/license/new-bsd New BSD License
32
* @version $Id: Priority.php 8064 2008-02-16 10:58:39Z thomas $
34
class Zend_Log_Filter_Priority implements Zend_Log_Filter_Interface
47
* Filter logging by $priority. By default, it will accept any log
48
* event whose priority value is less than or equal to $priority.
50
* @param integer $priority Priority
51
* @param string $operator Comparison operator
52
* @throws Zend_Log_Exception
54
public function __construct($priority, $operator = '<=')
56
if (! is_integer($priority)) {
57
throw new Zend_Log_Exception('Priority must be an integer');
60
$this->_priority = $priority;
61
$this->_operator = $operator;
65
* Returns TRUE to accept the message, FALSE to block it.
67
* @param array $event event data
68
* @return boolean accepted?
70
public function accept($event)
72
return version_compare($event['priority'], $this->_priority, $this->_operator);