[FrameworkBundle] made logger optional in ExceptionManager
This commit is contained in:
parent
47a26a0a42
commit
42cad4e57e
@ -29,7 +29,7 @@ class ExceptionManager
|
|||||||
protected $logger;
|
protected $logger;
|
||||||
protected $currentContent;
|
protected $currentContent;
|
||||||
|
|
||||||
public function __construct(\Exception $exception, Request $request, DebugLoggerInterface $logger)
|
public function __construct(\Exception $exception, Request $request, DebugLoggerInterface $logger = null)
|
||||||
{
|
{
|
||||||
$this->exception = $exception;
|
$this->exception = $exception;
|
||||||
$this->request = $request;
|
$this->request = $request;
|
||||||
@ -58,11 +58,15 @@ class ExceptionManager
|
|||||||
|
|
||||||
public function getLogs()
|
public function getLogs()
|
||||||
{
|
{
|
||||||
return $this->logger->getLogs();
|
return null === $this->logger ? array() : $this->logger->getLogs();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function countErrors()
|
public function countErrors()
|
||||||
{
|
{
|
||||||
|
if (null === $this->logger) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
$errors = 0;
|
$errors = 0;
|
||||||
foreach ($this->logger->getLogs() as $log) {
|
foreach ($this->logger->getLogs() as $log) {
|
||||||
if ('ERR' === $log['priorityName']) {
|
if ('ERR' === $log['priorityName']) {
|
||||||
|
Reference in New Issue
Block a user