Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Zend log filter sample #4813

Merged
merged 3 commits into from
Jul 19, 2013
Merged

Zend log filter sample #4813

merged 3 commits into from
Jul 19, 2013

Conversation

corentin-larose
Copy link
Contributor

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:

$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);

@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling 9530e34 on qapa:zend-log-filter-sample into 1166733 on zendframework:develop.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling 9530e34 on qapa:zend-log-filter-sample into 1166733 on zendframework:develop.

@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling 9530e34 on qapa:zend-log-filter-sample into 1166733 on zendframework:develop.

@corentin-larose
Copy link
Contributor Author

I don't understand why Travis failed (only for PHP 5.3.3), it seems to be related to the test logic itself.

@weierophinney
Copy link
Member

@corentin-larose The failure doesn't seem to be based on your test - the Log tests are passing. I'll review today.

*
* @var float
*/
protected $_sampleRate;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We no longer underscore-prefix non-public members; I can change this during merge.

@ghost ghost assigned weierophinney Jul 19, 2013
weierophinney added a commit that referenced this pull request Jul 19, 2013
weierophinney added a commit that referenced this pull request Jul 19, 2013
- no longer underscore-prefixing non-public properties
weierophinney added a commit that referenced this pull request Jul 19, 2013
@weierophinney weierophinney merged commit 9530e34 into zendframework:develop Jul 19, 2013
@corentin-larose corentin-larose deleted the zend-log-filter-sample branch March 14, 2014 12:39
weierophinney added a commit to zendframework/zend-log that referenced this pull request May 15, 2015
weierophinney added a commit to zendframework/zend-log that referenced this pull request May 15, 2015
- no longer underscore-prefixing non-public properties
weierophinney added a commit to zendframework/zend-log that referenced this pull request May 15, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants