Add the error level in cli

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@1733 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2014-08-19 09:17:00 +00:00
parent 8056491a1a
commit 526349a5d4

21
cli.php
View File

@@ -28,7 +28,26 @@ class cli
// This error code is not included in error_reporting
return;
}
file_put_contents ("php://stderr", "$errstr [".basename ($errfile) .
switch($errno)
{
case E_ERROR: $severity = "ERROR"; break;
case E_WARNING: $severity = "WARNING"; break;
case E_PARSE: $severity = "PARSE"; break;
case E_NOTICE: $severity = "NOTICE"; break;
case E_CORE_ERROR: $severity = "CORE_ERROR"; break;
case E_CORE_WARNING: $severity = "CORE_WARNING"; break;
case E_COMPILE_ERROR: $severity = "COMPILE_ERROR"; break;
case E_COMPILE_WARNING: $severity = "COMPILE_WARNING"; break;
case E_USER_ERROR: $severity = "USER_ERROR"; break;
case E_USER_WARNING: $severity = "USER_WARNING"; break;
case E_USER_NOTICE: $severity = "USER_NOTICE"; break;
case E_STRICT: $severity = "STRICT"; break;
case E_RECOVERABLE_ERROR: $severity = "RECOVERABLE_ERROR"; break;
case E_DEPRECATED: $severity = "DEPRECATED"; break;
case E_USER_DEPRECATED: $severity = "USER_DEPRECATED"; break;
}
file_put_contents ("php://stderr", sprintf ("%-17s", $severity)."-".
"$errstr [".basename ($errfile) .
":$errline]\n");
}