1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-07-30 09:50:26 +02:00

Drop support for aws-php-sdk v2 from DynamoDbHandler

This commit is contained in:
Jordi Boggiano
2022-03-05 14:22:06 +01:00
parent 5eb9b8ed93
commit 657ff7f916
2 changed files with 3 additions and 19 deletions

View File

@@ -17,7 +17,7 @@
"psr/log": "^2.0 || ^3.0"
},
"require-dev": {
"aws/aws-sdk-php": "^2.4.9 || ^3.0",
"aws/aws-sdk-php": "^3.0",
"doctrine/couchdb": "~1.0@dev",
"elasticsearch/elasticsearch": "^7",
"mongodb/mongodb": "^1.8",

View File

@@ -39,11 +39,6 @@ class DynamoDbHandler extends AbstractProcessingHandler
*/
protected $table;
/**
* @var int
*/
protected $version;
/**
* @var Marshaler
*/
@@ -51,13 +46,7 @@ class DynamoDbHandler extends AbstractProcessingHandler
public function __construct(DynamoDbClient $client, string $table, $level = Logger::DEBUG, bool $bubble = true)
{
/** @phpstan-ignore-next-line */
if (defined('Aws\Sdk::VERSION') && version_compare(Sdk::VERSION, '3.0', '>=')) {
$this->version = 3;
$this->marshaler = new Marshaler;
} else {
$this->version = 2;
}
$this->marshaler = new Marshaler;
$this->client = $client;
$this->table = $table;
@@ -71,12 +60,7 @@ class DynamoDbHandler extends AbstractProcessingHandler
protected function write(LogRecord $record): void
{
$filtered = $this->filterEmptyFields($record->formatted);
if ($this->version === 3) {
$formatted = $this->marshaler->marshalItem($filtered);
} else {
/** @phpstan-ignore-next-line */
$formatted = $this->client->formatAttributes($filtered);
}
$formatted = $this->marshaler->marshalItem($filtered);
$this->client->putItem([
'TableName' => $this->table,