Formatters

Filters

A Filter object blocks a message from being written to the log.

Filtering for All Writers

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

  1. span style="color: #ff0000;">'php://output'// blocked
  2. 'Informational message');
  3.  
  4. // logged
  5. '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.

Filtering for a Writer Instance

To filter only on a specific Writer instance, use the addFilter() method of that Writer:

  1. span style="color: #ff0000;">'/path/to/first/logfile''/path/to/second/logfile'// add a filter only to writer2
  2. // logged to writer1, blocked from writer2
  3. 'Informational message');
  4.  
  5. // logged by both writers
  6. 'Emergency message');

Formatters