PhpRiot
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Filtering for All Writers

To filter before all writers, you can add any number of Filters to a Log object using the addFilter() method:

<?php
$logger 
= new Zend_Log();

$writer = new Zend_Log_Writer_Stream('php://output');
$logger->addWriter($writer);

$filter = new Zend_Log_Filter_Priority(Zend_Log::CRIT);
$logger->addFilter($filter);

// blocked
$logger->info('Informational message');

// logged
$logger->emerg('Emergency message');

When you add one or more Filters to the Log object, the message must pass through all of the Filters before any Writers receives it.

Zend Framework