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
16 changes: 15 additions & 1 deletion src/Monolog/LogsHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Monolog\LogRecord;
use Sentry\Logs\LogLevel;
use Sentry\Logs\Logs;
use Sentry\Util\Arr;

class LogsHandler implements HandlerInterface
{
Expand Down Expand Up @@ -66,7 +67,7 @@
self::getSentryLogLevelFromMonologLevel($record['level']),
$record['message'],
[],
array_merge($record['context'], $record['extra'], ['sentry.origin' => 'auto.logger.monolog'])
$this->compileAttributes($record)
);

return $this->bubble === false;
Expand Down Expand Up @@ -123,4 +124,17 @@
// Just in case so that the destructor can never fail.
}
}

/**
* @param array<string, mixed>|LogRecord $record
*/
protected function compileAttributes($record): array

Check failure on line 131 in src/Monolog/LogsHandler.php

View workflow job for this annotation

GitHub Actions / PHPStan

Method Sentry\Monolog\LogsHandler::compileAttributes() return type has no value type specified in iterable type array.
{
return [
...Arr::simpleDot(['context' => $record['context']]),
...Arr::simpleDot(['extra' => $record['extra']]),
'log.channel' => $record['channel'],
'sentry.origin' => 'auto.logger.monolog',
];
}
}
Loading