From 8f3068f8523e602ce8676a7c5be8102b58c5ad8c Mon Sep 17 00:00:00 2001 From: Martin Melka Date: Tue, 17 Mar 2026 14:15:04 +0100 Subject: [PATCH] Add Monolog channel to compiled log attributes The channel is a relevant piece of metadata of a log entry. This change includes the channel in the recorded attributes, but remains backwards compatible and will not overwrite existing extra or context fields named 'channel'. --- src/Monolog/LogsHandler.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Monolog/LogsHandler.php b/src/Monolog/LogsHandler.php index 9eb49e440..574488032 100644 --- a/src/Monolog/LogsHandler.php +++ b/src/Monolog/LogsHandler.php @@ -144,6 +144,6 @@ public function __destruct() */ protected function compileAttributes($record): array { - return array_merge($record['context'], $record['extra'], ['sentry.origin' => 'auto.log.monolog']); + return array_merge(['channel' => $record['channel']], $record['context'], $record['extra'], ['sentry.origin' => 'auto.log.monolog']); } }