Closed elliot-sawyer closed 1 year ago
The Silverstripe 4 version uses monolog/monolog: 1.27.1
. The CMS5 version checks out monolog/monolog: 3.3.1
Have not tested this in anger yet, but I managed to get it to report a basic message to Sentry. Add the following to any given _config.php file:
use Monolog\Level;
use Psr\Log\LoggerInterface;
use SilverStripe\Core\Injector\Injector;
$logger = Injector::inst()->get(LoggerInterface::class);
$logger->log(Level::Error, 'silverstripe 5 test');
Hi @elliot-sawyer, thanks for your PR. You reckon you can add:
/**
* @var mixed ClientBuilder|null
*/
private $client = null;
to SentryHandler.php
to get rid of the deprecated notice?
Cheers
Thanks @elliot-sawyer and @BarryWype I've manually applied both changes and the module builds, tests pass and I've tested both exception handling and manual logging as per @elliot-sawyer's example above.
See tag 5.0
.
Thanks heaps.
I tried installing this on Silverstripe 5. Initially just added a || ^5 to composer.json, but there's some underlying fixes to the library that need to be made:
protected function write(array $record): void => protected function write(Monolog\LogRecord $record): void