public static function errorHandler($level, $message, $file, $line)
    {
        if (! ($level & error_reporting()))
            return false;
        switch ($level) {
            case E_NOTICE:
            case E_USER_NOTICE:
                $method = 'notice';
                $type = 'Notice';
                break;
            case E_WARNING:
            case E_USER_WARNING:
                $method = 'warn';
                $type = 'Warning';
                break;
            case E_ERROR:
            case E_USER_ERROR:
                $method = 'crit';
                $type = 'Fatal Error';
                break;
            default:
                $method = 'err';
                $type = 'Unknown, ' . $level;
                break;
        }
        self::$errors[] = array(
            'type' => $type ,
            'message' => $message ,
            'file' => $file ,
            'line' => $line,
            'trace' => debug_backtrace()
        );

        $message = sprintf(
            "%s in %s on line %d",
            $message,
            str_replace($_SERVER['DOCUMENT_ROOT'], '', $file),
            $line
        );
        // if (ini_get('log_errors'))
        //     error_log(sprintf("%s: %s", $type, $message));

        if (($logger = self::getLogger())) {
            $logger->$method($message);
        }
        return false;
    }