LSlog: log PHP error suppressed with the @-operator at TRACE level and add a prefix to signal it

This commit is contained in:
Benjamin Renard 2024-09-26 17:35:19 +02:00
parent 977dc8fcfa
commit 0e705852af
Signed by: bn8
GPG key ID: 3E2E1CE1907115BC

View file

@ -468,7 +468,18 @@ class LSlog {
);
$error = (isset($errnos2error[$errno])?$errnos2error[$errno]:'UNKNOWN');
$level = (isset($errors2level[$error])?$errors2level[$error]:'ERROR');
self :: logging($level, "A PHP $error occured (#$errno) : $errstr [$errfile:$errline]");
// Log error suppressed with the @-operator at TRACE level and add a prefix to signal it
$prefix = "";
$error_reporting = error_reporting();
if ( !($error_reporting & $errno) ) {
$level = "TRACE";
$prefix = "[IGNORE BY @ OPERATOR] ";
}
self :: logging(
$level,
"{$prefix}A PHP $error occured (#$errno) : $errstr [$errfile:$errline]"
);
return False;
}