Skip to content

Commit 77a1238

Browse files
committed
Fix initalization of logger service
1 parent 569c9f3 commit 77a1238

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/Connection.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Aws\DynamoDb\DynamoDbClient;
66
use Aws\DynamoDb\Exception\DynamoDbException;
77
use Drupal\Core\Logger\LoggerChannelInterface;
8+
use Drupal\Core\Logger\LoggerChannelTrait;
89
use Drupal\Core\Site\Settings;
910

1011
/**
@@ -14,6 +15,8 @@
1415
*/
1516
class Connection implements DynamoDbInterface {
1617

18+
use LoggerChannelTrait;
19+
1720
/**
1821
* The DynamoDB client factory.
1922
*
@@ -40,7 +43,7 @@ class Connection implements DynamoDbInterface {
4043
*
4144
* @var \Drupal\Core\Logger\LoggerChannelInterface
4245
*/
43-
protected LoggerChannelInterface $loggerFactory;
46+
protected $loggerChannel;
4447

4548
/**
4649
* Static cache for consistent read option.
@@ -305,7 +308,7 @@ public function deleteTable(array $params): bool {
305308
*/
306309
public function listTables(array $params): array {
307310
try {
308-
$this->dynamoDb->listTables($params);
311+
$response = $this->dynamoDb->listTables($params);
309312
}
310313
catch (DynamoDbException $e) {
311314
$this->logger()->error($e);
@@ -368,10 +371,10 @@ protected function getBillingMode(string $table): array {
368371
* The logger.
369372
*/
370373
protected function logger(): LoggerChannelInterface {
371-
if (!$this->loggerFactory) {
372-
$this->loggerFactory = \Drupal::service('logger.factory')->get('dynamodb_client');
374+
if (!$this->loggerChannel) {
375+
$this->loggerChannel = $this->getLogger('dynamodb_client');
373376
}
374-
return $this->loggerFactory;
377+
return $this->loggerChannel;
375378
}
376379

377380
}

0 commit comments

Comments
 (0)