1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-10-22 17:16:18 +02:00

Add LogRecord class, drop PHP <8.1

This commit is contained in:
Jordi Boggiano
2022-02-20 14:39:51 +01:00
parent f2f66cd480
commit 22c8b19358
111 changed files with 501 additions and 361 deletions

View File

@@ -12,6 +12,7 @@
namespace Monolog\Handler;
use Monolog\Formatter\FormatterInterface;
use Monolog\LogRecord;
/**
* Sampling handler
@@ -62,12 +63,12 @@ class SamplingHandler extends AbstractHandler implements ProcessableHandlerInter
}
}
public function isHandling(array $record): bool
public function isHandling(LogRecord $record): bool
{
return $this->getHandler($record)->isHandling($record);
}
public function handle(array $record): bool
public function handle(LogRecord $record): bool
{
if ($this->isHandling($record) && mt_rand(1, $this->factor) === 1) {
if ($this->processors) {
@@ -90,7 +91,7 @@ class SamplingHandler extends AbstractHandler implements ProcessableHandlerInter
*
* @return HandlerInterface
*/
public function getHandler(array $record = null)
public function getHandler(LogRecord $record = null)
{
if (!$this->handler instanceof HandlerInterface) {
$this->handler = ($this->handler)($record, $this);