public static function exception(\Exception $exception, Logger $logger, $exit = true)
    {
        static::log($exception, $logger);

        ob_get_length() > 0 && ob_get_level() && ob_end_clean();

        if (Config::get('error.debug_info') === true) {
            echo static::format($exception, Sapi::isCli());
            if ($exit) {
                exit;
            }
        }

        if ($exception instanceof \Pimf\Controller\Exception
            || $exception instanceof \Pimf\Resolver\Exception
        ) {
            Event::first('404', array($exception));
            Header::sendNotFound(null, $exit);
        } else {
            Event::first('500', array($exception));
            Header::sendInternalServerError(null, $exit);
        }
    }