Last active
July 1, 2019 15:47
-
-
Save kinglozzer/a9334ae31a7e544f4ba397888503fcb1 to your computer and use it in GitHub Desktop.
InterventionBackend logging
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/InterventionBackend.php b/src/InterventionBackend.php | |
index 81bcd97..dc251bc 100644 | |
--- a/src/InterventionBackend.php | |
+++ b/src/InterventionBackend.php | |
@@ -13,6 +13,7 @@ use Intervention\Image\Size; | |
use InvalidArgumentException; | |
use LogicException; | |
use Psr\Http\Message\StreamInterface; | |
+use Psr\Log\LoggerInterface; | |
use Psr\SimpleCache\CacheInterface; | |
use SilverStripe\Assets\Storage\AssetContainer; | |
use SilverStripe\Assets\Storage\AssetStore; | |
@@ -271,6 +272,10 @@ class InterventionBackend implements Image_Backend, Flushable | |
// Handle unsupported image encoding on load (will be marked as failed) | |
// Unsupported exceptions are handled without being raised as exceptions | |
$error = self::FAILED_INVALID; | |
+ | |
+ if (Injector::inst()->has(LoggerInterface::class.'.InterventionBackend')) { | |
+ Injector::inst()->get(LoggerInterface::class.'.InterventionBackend')->error($ex->getMessage(), ['exception' => $ex]); | |
+ } | |
} finally { | |
if ($error) { | |
$this->markFailed($hash, $variant, $error); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment