1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-10-23 09:36:11 +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

@@ -128,7 +128,6 @@ class SlackRecord
public function getSlackData(LogRecord $record): array
{
$dataArray = array();
$record = $this->removeExcludedFields($record);
if ($this->username) {
$dataArray['username'] = $this->username;
@@ -142,9 +141,11 @@ class SlackRecord
/** @phpstan-ignore-next-line */
$message = $this->formatter->format($record);
} else {
$message = $record['message'];
$message = $record->message;
}
$record = $this->removeExcludedFields($record);
if ($this->useAttachment) {
$attachment = array(
'fallback' => $message,
@@ -226,8 +227,7 @@ class SlackRecord
*/
public function stringify(array $fields): string
{
/** @var Record $fields */
$normalized = $this->normalizerFormatter->format($fields);
$normalized = $this->normalizerFormatter->normalizeValue($fields);
$hasSecondDimension = count(array_filter($normalized, 'is_array'));
$hasNonNumericKeys = !count(array_filter(array_keys($normalized), 'is_numeric'));
@@ -347,8 +347,7 @@ class SlackRecord
*/
private function generateAttachmentFields(array $data): array
{
/** @var Record $data */
$normalized = $this->normalizerFormatter->format($data);
$normalized = $this->normalizerFormatter->normalizeValue($data);
$fields = array();
foreach ($normalized as $key => $value) {
@@ -367,6 +366,7 @@ class SlackRecord
*/
private function removeExcludedFields(LogRecord $record): array
{
$record = $record->toArray();
foreach ($this->excludeFields as $field) {
$keys = explode('.', $field);
$node = &$record;