zendframework/zf2 — pull request #4811 by corentin-larose (2013-07-12 10:23:05+00:00)
Title: New sample filter for Zend\Log

This filter is intended to sample events by a given factor for events intensive scripts.

Never forget this is a random based sampling, thus, you never exactly know which event will be logged.

Usage:

```php

$logger = new Zend\Log\Logger();

$writer = new Zend\Log\Writer\Stream('/path/to/first/logfile');
$logger->addWriter($writer);

// No event is logged
$filter = new Zend\Log\Filter\Sample(0);
$writer->addFilter($filter);

// All events are logged
$filter = new Zend\Log\Filter\Sample(1);
$writer->addFilter($filter);

// 2 random events among 3 are logged
$filter = new Zend\Log\Filter\Sample(2/3);
$writer->addFilter($filter);
```