Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/Logs/Monolog/src/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,16 @@ class Handler extends AbstractProcessingHandler
/** @var API\LoggerInterface[] */
private array $loggers = [];
private API\LoggerProviderInterface $loggerProvider;
private ?FormatterInterface $formatterInterface;

/**
* @psalm-suppress InvalidArgument
*/
public function __construct(API\LoggerProviderInterface $loggerProvider, $level, bool $bubble = true)
public function __construct(API\LoggerProviderInterface $loggerProvider, $level, bool $bubble = true, ?FormatterInterface $formatterInterface = null)
{
parent::__construct($level, $bubble);
$this->loggerProvider = $loggerProvider;
$this->formatterInterface = $formatterInterface;
}

protected function getLogger(string $channel): API\LoggerInterface
Expand All @@ -36,7 +38,7 @@ protected function getLogger(string $channel): API\LoggerInterface

protected function getDefaultFormatter(): FormatterInterface
{
return new NormalizerFormatter();
return $this->formatterInterface ?? new NormalizerFormatter();
}

/**
Expand Down