Added logger to classes that catch errors in order to log them

This commit is contained in:
Alejandro Celaya
2016-08-08 12:33:58 +02:00
parent fff058f44b
commit 34753ca7d3
8 changed files with 85 additions and 19 deletions

View File

@@ -3,10 +3,22 @@ namespace Shlinkio\Shlink\Rest\Action;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use Psr\Log\LoggerInterface;
use Psr\Log\NullLogger;
use Zend\Stratigility\MiddlewareInterface;
abstract class AbstractRestAction implements MiddlewareInterface
{
/**
* @var LoggerInterface
*/
protected $logger;
public function __construct(LoggerInterface $logger = null)
{
$this->logger = $logger ?: new NullLogger();
}
/**
* Process an incoming request and/or response.
*