mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-03 19:57:41 +02:00
Drop support for aws-php-sdk v2 from DynamoDbHandler
This commit is contained in:
@@ -17,7 +17,7 @@
|
|||||||
"psr/log": "^2.0 || ^3.0"
|
"psr/log": "^2.0 || ^3.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"aws/aws-sdk-php": "^2.4.9 || ^3.0",
|
"aws/aws-sdk-php": "^3.0",
|
||||||
"doctrine/couchdb": "~1.0@dev",
|
"doctrine/couchdb": "~1.0@dev",
|
||||||
"elasticsearch/elasticsearch": "^7",
|
"elasticsearch/elasticsearch": "^7",
|
||||||
"mongodb/mongodb": "^1.8",
|
"mongodb/mongodb": "^1.8",
|
||||||
|
@@ -39,11 +39,6 @@ class DynamoDbHandler extends AbstractProcessingHandler
|
|||||||
*/
|
*/
|
||||||
protected $table;
|
protected $table;
|
||||||
|
|
||||||
/**
|
|
||||||
* @var int
|
|
||||||
*/
|
|
||||||
protected $version;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Marshaler
|
* @var Marshaler
|
||||||
*/
|
*/
|
||||||
@@ -51,13 +46,7 @@ class DynamoDbHandler extends AbstractProcessingHandler
|
|||||||
|
|
||||||
public function __construct(DynamoDbClient $client, string $table, $level = Logger::DEBUG, bool $bubble = true)
|
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;
|
$this->marshaler = new Marshaler;
|
||||||
} else {
|
|
||||||
$this->version = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->client = $client;
|
$this->client = $client;
|
||||||
$this->table = $table;
|
$this->table = $table;
|
||||||
@@ -71,12 +60,7 @@ class DynamoDbHandler extends AbstractProcessingHandler
|
|||||||
protected function write(LogRecord $record): void
|
protected function write(LogRecord $record): void
|
||||||
{
|
{
|
||||||
$filtered = $this->filterEmptyFields($record->formatted);
|
$filtered = $this->filterEmptyFields($record->formatted);
|
||||||
if ($this->version === 3) {
|
|
||||||
$formatted = $this->marshaler->marshalItem($filtered);
|
$formatted = $this->marshaler->marshalItem($filtered);
|
||||||
} else {
|
|
||||||
/** @phpstan-ignore-next-line */
|
|
||||||
$formatted = $this->client->formatAttributes($filtered);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->client->putItem([
|
$this->client->putItem([
|
||||||
'TableName' => $this->table,
|
'TableName' => $this->table,
|
||||||
|
Reference in New Issue
Block a user