1: <?php
2: /**
3: * Horde Log package
4: *
5: * @author Bryan Alves <bryanalves@gmail.com>
6: * @category Horde
7: * @license http://www.horde.org/licenses/bsd BSD
8: * @package Log
9: * @subpackage Filters
10: */
11:
12: /**
13: * @author Bryan Alves <bryanalves@gmail.com>
14: * @category Horde
15: * @license http://www.horde.org/licenses/bsd BSD
16: * @package Log
17: * @subpackage Filters
18: */
19: class Horde_Log_Filter_ExactLevel implements Horde_Log_Filter
20: {
21: /**
22: * @var integer
23: */
24: protected $_level;
25:
26: /**
27: * Filter out any log messages not equal to $level.
28: *
29: * @param integer $level Log level to pass through the filter
30: */
31: public function __construct($level)
32: {
33: if (!is_integer($level)) {
34: throw new Horde_Log_Exception('Level must be an integer');
35: }
36:
37: $this->_level = $level;
38: }
39:
40: /**
41: * Returns TRUE to accept the message, FALSE to block it.
42: *
43: * @param array $event Log event
44: * @return boolean accepted?
45: */
46: public function accept($event)
47: {
48: return $event['level'] == $this->_level;
49: }
50: }
51: