diff --git a/Classes/S3Storage.php b/Classes/S3Storage.php index 432dac8..1f5af15 100644 --- a/Classes/S3Storage.php +++ b/Classes/S3Storage.php @@ -9,6 +9,7 @@ use Aws\S3\Exception\S3Exception; use Aws\S3\S3Client; use Neos\Flow\Annotations as Flow; +use Neos\Flow\Log\Utility\LogEnvironment; use Neos\Flow\ResourceManagement\CollectionInterface; use Neos\Flow\ResourceManagement\PersistentResource; use Neos\Flow\ResourceManagement\ResourceManager; @@ -307,7 +308,7 @@ public function getStreamByResource(PersistentResource $resource) return false; } $message = sprintf('Could not retrieve stream for resource %s (s3://%s/%s%s). %s', $resource->getFilename(), $this->bucketName, $this->keyPrefix, $resource->getSha1(), $e->getMessage()); - $this->systemLogger->error($message); + $this->systemLogger->error($message, LogEnvironment::fromMethodName(__METHOD__)); return false; } } @@ -330,7 +331,7 @@ public function getStreamByResourcePath($relativePath) return false; } $message = sprintf('Could not retrieve stream for resource (s3://%s/%s%s). %s', $this->bucketName, $this->keyPrefix, ltrim('/', $relativePath), $e->getMessage()); - $this->systemLogger->error($message); + $this->systemLogger->error($message, LogEnvironment::fromMethodName(__METHOD__)); return false; } } @@ -418,9 +419,9 @@ protected function importTemporaryFile($temporaryPathAndFilename, $collectionNam 'ContentType' => $resource->getMediaType(), 'Key' => $objectName ]); - $this->systemLogger->info(sprintf('Successfully imported resource as object "%s" into bucket "%s" with MD5 hash "%s"', $objectName, $this->bucketName, $resource->getMd5() ?: 'unknown')); + $this->systemLogger->info(sprintf('Successfully imported resource as object "%s" into bucket "%s" with MD5 hash "%s"', $objectName, $this->bucketName, $resource->getMd5() ?: 'unknown'), LogEnvironment::fromMethodName(__METHOD__)); } else { - $this->systemLogger->info(sprintf('Did not import resource as object "%s" into bucket "%s" because that object already existed.', $objectName, $this->bucketName)); + $this->systemLogger->info(sprintf('Did not import resource as object "%s" into bucket "%s" because that object already existed.', $objectName, $this->bucketName), LogEnvironment::fromMethodName(__METHOD__)); } return $resource; diff --git a/Classes/S3Target.php b/Classes/S3Target.php index 5628853..0d9b801 100644 --- a/Classes/S3Target.php +++ b/Classes/S3Target.php @@ -9,6 +9,7 @@ use Aws\S3\Exception\S3Exception; use Aws\S3\S3Client; use Neos\Flow\Annotations as Flow; +use Neos\Flow\Log\Utility\LogEnvironment; use Neos\Flow\ResourceManagement\CollectionInterface; use Neos\Flow\ResourceManagement\Exception; use Neos\Flow\ResourceManagement\Publishing\MessageCollector; @@ -220,7 +221,7 @@ public function publishCollection(CollectionInterface $collection, callable $cal $this->systemLogger->debug(sprintf('Successfully copied resource as object "%s" (MD5: %s) from bucket "%s" to bucket "%s"', $objectName, $object->getMd5() ?: 'unknown', $storageBucketName, $this->bucketName)); } catch (S3Exception $e) { $message = sprintf('Could not copy resource with SHA1 hash %s of collection %s from bucket %s to %s: %s', $object->getSha1(), $collection->getName(), $storageBucketName, $this->bucketName, $e->getMessage()); - $this->systemLogger->critical($e); + $this->systemLogger->critical($e, LogEnvironment::fromMethodName(__METHOD__)); $this->messageCollector->append($message); } } @@ -291,7 +292,7 @@ public function publishResource(PersistentResource $resource, CollectionInterfac $this->systemLogger->debug(sprintf('Successfully published resource as object "%s" (MD5: %s) by copying from bucket "%s" to bucket "%s"', $objectName, $resource->getMd5() ?: 'unknown', $storage->getBucketName(), $this->bucketName)); } catch (S3Exception $e) { $message = sprintf('Could not publish resource with SHA1 hash %s of collection %s (source object: %s) through "CopyObject" because the S3 client reported an error: %s', $resource->getSha1(), $collection->getName(), $sourceObjectArn, $e->getMessage()); - $this->systemLogger->critical($e); + $this->systemLogger->critical($e, LogEnvironment::fromMethodName(__METHOD__)); $this->messageCollector->append($message); } } else { diff --git a/composer.json b/composer.json index 323528e..5f6571f 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,7 @@ "MIT" ], "require": { - "neos/flow": "^5.0 || ^6.0", + "neos/flow": "^5.2 || ^6.0", "aws/aws-sdk-php": "~3.0" }, "autoload": {