1: <?php
2: /**
3: * This file is part of the Autarky package.
4: *
5: * (c) Andreas Lutro <anlutro@gmail.com>
6: *
7: * For the full copyright and license information, please view the LICENSE
8: * file that was distributed with this source code.
9: */
10:
11: namespace Autarky\Logging;
12:
13: use Autarky\Errors\ErrorHandlerInterface;
14: use Exception;
15: use Psr\Log\LoggerInterface;
16:
17: /**
18: * This simple error handler logs exceptions.
19: */
20: class LoggingErrorHandler implements ErrorHandlerInterface
21: {
22: protected $logger;
23:
24: public function __construct(LoggerInterface $logger)
25: {
26: $this->logger = $logger;
27: }
28:
29: public function handle(Exception $exception)
30: {
31: $this->logger->error($exception);
32: }
33: }
34: