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

Fix some issues, bump phpunit version

This commit is contained in:
Jordi Boggiano
2022-02-26 15:09:41 +01:00
parent 22c8b19358
commit 400effdd45
45 changed files with 602 additions and 774 deletions

View File

@@ -53,9 +53,12 @@ class NormalizerFormatter implements FormatterInterface
*/
public function format(LogRecord $record)
{
$record = $record->toArray();
return $this->normalizeRecord($record);
}
return $this->normalize($record);
public function normalizeValue(mixed $data): mixed
{
return $this->normalize($data);
}
/**
@@ -126,11 +129,22 @@ class NormalizerFormatter implements FormatterInterface
return $this;
}
/**
* Provided as extension point
*
* Because normalize is called with sub-values of context data etc, normalizeRecord can be
* extended when data needs to be appended on the record array but not to other normalized data.
*/
protected function normalizeRecord(LogRecord $record): array
{
return $this->normalize($record->toArray());
}
/**
* @param mixed $data
* @return null|scalar|array<array|scalar|null>
*/
protected function normalize($data, int $depth = 0)
protected function normalize(mixed $data, int $depth = 0): mixed
{
if ($depth > $this->maxNormalizeDepth) {
return 'Over ' . $this->maxNormalizeDepth . ' levels deep, aborting normalization';