Skip to content
Snippets Groups Projects
LogHandler.php 557 B
Newer Older
Thomas Flori's avatar
Thomas Flori committed
<?php

namespace App\Service\Exception;

use App\Application;
use App\Service\Exception\Formatter\Log as LogFormatter;
use Whoops\Handler\Handler;

class LogHandler extends Handler
{
    public function handle()
    {
        $logger = Application::logger();

        /** @var LogFormatter $formatter */
        $formatter = Application::app()->make(LogFormatter::class, $this->getInspector());

        $logger->error($formatter->formatMessage());
        $logger->debug('Stack Trace: ' . $formatter->formatTrace());

        return Handler::DONE;
    }
}