CChainedLogFilter.php 1.2 KB

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