1: <?php
2: /**
3: * CChainedLogFilter class file
4: *
5: * @author Carsten Brandt <mail@cebe.cc>
6: * @link http://www.yiiframework.com/
7: * @copyright 2008-2013 Yii Software LLC
8: * @license http://www.yiiframework.com/license/
9: */
10:
11: /**
12: * CChainedLogFilter allows you to attach multiple log filters to a log route (See {@link CLogRoute::$filter} for details).
13: *
14: * @author Carsten Brandt <mail@cebe.cc>
15: * @package system.logging
16: * @since 1.1.13
17: */
18: class CChainedLogFilter extends CComponent implements ILogFilter
19: {
20: /**
21: * @var array list of filters to apply to the logs.
22: * The value of each array element will be passed to {@link Yii::createComponent} to create
23: * a log filter object. As a result, this can be either a string representing the
24: * filter class name or an array representing the filter configuration.
25: * In general, the log filter classes should implement {@link ILogFilter} interface.
26: * Filters will be applied in the order they are defined.
27: */
28: public $filters=array();
29:
30: /**
31: * Filters the given log messages by applying all filters configured by {@link filters}.
32: * @param array $logs the log messages
33: */
34: public function filter(&$logs)
35: {
36: foreach($this->filters as $filter)
37: Yii::createComponent($filter)->filter($logs);
38: }
39: }