From 04a0c973d08c9ac9bb94f1c9d84b1006c4e237a0 Mon Sep 17 00:00:00 2001 From: Bradley Schofield Date: Fri, 10 May 2024 11:17:24 +0900 Subject: [PATCH] Address Eldad's Comments --- src/Logger/Logger.php | 14 +++++++++++++- tests/e2e/AdapterBase.php | 2 +- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/Logger/Logger.php b/src/Logger/Logger.php index 71c61fa..0db8f49 100644 --- a/src/Logger/Logger.php +++ b/src/Logger/Logger.php @@ -103,8 +103,20 @@ public static function hasProvider(string $providerName): bool * @param float $sample Total percentage of issues to use with 100% being 1 * @return void */ - public function sample(float $sample) + public function setSample(float $sample): self { $this->samplePercent = $sample * 100; + + return $this; + } + + /** + * Get the current sample value as a percentage + * + * @return float + */ + public function getSample(): float + { + return $this->samplePercent; } } diff --git a/tests/e2e/AdapterBase.php b/tests/e2e/AdapterBase.php index bdb5f55..db7a604 100755 --- a/tests/e2e/AdapterBase.php +++ b/tests/e2e/AdapterBase.php @@ -68,7 +68,7 @@ public function testSampler(): void throw new \Exception('Log or adapter not set'); } $logger = new Logger($this->adapter); - $logger->sample(0.1); + $logger->setSample(0.001); $results = [];