Caution: The documentation you are viewing is
for an older version of Zend Framework.
You can find the documentation of the current version at docs.zendframework.com
Filters — Zend Framework 2 2.1.5 documentation
A Filter object blocks a message from being written to the log.
You can add a filter to a specific Writer using addFilter() method of that Writer:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
use Zend\Log\Logger; $logger = new Logger(); $writer1 = new Zend\Log\Writer\Stream('/path/to/first/logfile'); $logger->addWriter($writer1); $writer2 = new Zend\Log\Writer\Stream('/path/to/second/logfile'); $logger->addWriter($writer2); // add a filter only to writer2 $filter = new Zend\Log\Filter\Priority(Logger::CRIT); $writer2->addFilter($filter); // logged to writer1, blocked from writer2 $logger->info('Informational message'); // logged by both writers $logger->emerg('Emergency message');
The Zend\Log\Filter available are: