MainLogger: always log exceptions with CRITICAL level

if we reached this point, it's almost always due to a general exception handler which doesn't know what else to do with the error.
This commit is contained in:
Dylan K. Taylor 2020-01-09 20:44:21 +00:00
parent 039478223e
commit fab81d28bc

View File

@ -227,11 +227,7 @@ class MainLogger extends \AttachableThreadedLogger{
E_DEPRECATED => "E_DEPRECATED",
E_USER_DEPRECATED => "E_USER_DEPRECATED"
];
if($errno === 0){
$type = LogLevel::CRITICAL;
}else{
$type = ($errno === E_ERROR or $errno === E_USER_ERROR) ? LogLevel::ERROR : (($errno === E_USER_WARNING or $errno === E_WARNING) ? LogLevel::WARNING : LogLevel::NOTICE);
}
$errno = $errorConversion[$errno] ?? $errno;
$errstr = preg_replace('/\s+/', ' ', trim($errstr));
$errfile = Utils::cleanPath($errfile);
@ -239,8 +235,8 @@ class MainLogger extends \AttachableThreadedLogger{
$message = get_class($e) . ": \"$errstr\" ($errno) in \"$errfile\" at line $errline";
$stack = Utils::printableTrace($trace);
$this->synchronized(function() use ($type, $message, $stack) : void{
$this->log($type, $message);
$this->synchronized(function() use ($message, $stack) : void{
$this->critical($message);
foreach($stack as $line){
$this->debug($line, true);
}