API Add PHP deprecation notices to setLogger and getLogger

This commit is contained in:
Robbie Averill 2018-11-13 11:12:06 +02:00
parent 8854f053c8
commit 580214cc30

View File

@ -5,6 +5,7 @@ namespace SilverStripe\Logging;
use InvalidArgumentException; use InvalidArgumentException;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
use Monolog\ErrorHandler as MonologHandler; use Monolog\ErrorHandler as MonologHandler;
use SilverStripe\Dev\Deprecation;
class MonologErrorHandler implements ErrorHandler class MonologErrorHandler implements ErrorHandler
{ {
@ -23,6 +24,8 @@ class MonologErrorHandler implements ErrorHandler
*/ */
public function setLogger(LoggerInterface $logger) public function setLogger(LoggerInterface $logger)
{ {
Deprecation::notice('4.4.0', 'Please use pushHandler() instead');
$this->loggers = [$logger]; $this->loggers = [$logger];
return $this; return $this;
} }
@ -35,6 +38,8 @@ class MonologErrorHandler implements ErrorHandler
*/ */
public function getLogger() public function getLogger()
{ {
Deprecation::notice('4.4.0', 'Please use getHandlers() instead');
return reset($this->loggers); return reset($this->loggers);
} }