Skip to content

Commit 01de10b

Browse files
authored
ref(logs): extract attribute compilation to dedicated method in LogsHandler (#1931)
Co-authored-by: Deeka Wong <[email protected]>
1 parent 6cad7b2 commit 01de10b

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/Monolog/LogsHandler.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public function handle($record): bool
6666
self::getSentryLogLevelFromMonologLevel($record['level']),
6767
$record['message'],
6868
[],
69-
array_merge($record['context'], $record['extra'], ['sentry.origin' => 'auto.log.monolog'])
69+
$this->compileAttributes($record)
7070
);
7171

7272
return $this->bubble === false;
@@ -123,4 +123,14 @@ public function __destruct()
123123
// Just in case so that the destructor can never fail.
124124
}
125125
}
126+
127+
/**
128+
* @param array<string,mixed>|LogRecord $record
129+
*
130+
* @return array<string,mixed>
131+
*/
132+
protected function compileAttributes($record): array
133+
{
134+
return array_merge($record['context'], $record['extra'], ['sentry.origin' => 'auto.log.monolog']);
135+
}
126136
}

0 commit comments

Comments
 (0)