public static function php_error_handler($errno, $errstr, $errfile, $errline, $errcontext) {
        if($errno & error_reporting()) {
            foreach(self::$error_handling_instances as list($logger, $level, $with_line, $with_trace)) {
                if(!($errno & $level)) {
                    continue;
                }

                switch($errno) {
                    case E_PARSE:
                        $severity = Message::ALERT;
                        break;
                    case E_CORE_ERROR:
                    case E_COMPILE_ERROR:
                        $severity = Message::CRITICAL;
                        break;
                    case E_ERROR:
                    case E_USER_ERROR:
                    case E_RECOVERABLE_ERROR:
                        $severity = Message::ERROR;
                        break;
                    case E_WARNING:
                    case E_CORE_WARNING:
                    case E_COMPILE_WARNING:
                    case E_USER_WARNING:
                        $severity = Message::WARNING;
                        break;
                    case E_NOTICE:
                    case E_USER_NOTICE:
                        $severity = Message::NOTICE;
                        break;
                    case E_DEPRECATED:
                    case E_USER_DEPRECATED:
                        $severity = Message::INFO;
                        break;
                    case E_STRICT:
                    default:
                        $severity = Message::DEBUG;
                        break;
                }

                $message = self::errnoToString($errno).": $errstr";

                if($with_line) {
                    $message = "$message in $errfile on line: $errline";
                }

                if($with_trace) {
                    throw new Exception("Not implemented yet.");
                }

                $logger->logMessage(new Message($message, $severity));
            }
        }

        return TRUE;
    }