public function shutdown() {
        if (($error = error_get_last())) {
            ob_clean();
            /* log error */
            $msg = $error["message"] . " in file: " . $error["file"] . " on line: " . $error["line"];
            $log = new Logger('kernel');
            $file = self::get("dir", "log") . "/log-" . date("Ymd") . ".log";
            $log->pushHandler(new StreamHandler($file, Logger::ERROR));
            switch ($this->mode) {
                case self::$MODE_PRODUCTION:
                    $log->addError($msg);
                    $request = new HttpRequest();
                    $class = self::get("defaultController");
                    $method = self::get("errorMethod");
                    $controller = new $class();
                    $this->dispatch($controller, $method, $request);
                    break;
                case self::$MODE_DEVELOPMENT:
                    die($msg);
                    break;

                default:
                    echo $msg;
                    break;
            }
        }
    }