mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
8dd644d25d
Namespace all templates Move difflib and BBCodeParser2 to thirdparty Remove deprecated API marked for removal in 4.0
31 lines
571 B
PHP
31 lines
571 B
PHP
<?php
|
|
|
|
namespace SilverStripe\Logging;
|
|
|
|
use Psr\Log\LoggerInterface;
|
|
use Monolog\ErrorHandler;
|
|
|
|
/**
|
|
* Simple adaptor to start Monolog\ErrorHandler
|
|
*/
|
|
class MonologErrorHandler
|
|
{
|
|
private $logger;
|
|
|
|
/**
|
|
* Set the PSR-3 logger to send errors & exceptions to
|
|
*/
|
|
function setLogger(LoggerInterface $logger) {
|
|
$this->logger = $logger;
|
|
}
|
|
|
|
function start() {
|
|
if(!$this->logger) {
|
|
throw new \InvalidArgumentException("No Logger property passed to MonologErrorHandler."
|
|
. "Is your Injector config correct?");
|
|
}
|
|
|
|
ErrorHandler::register($this->logger);
|
|
}
|
|
}
|