MainLogger: log exception chains in logException(), closes #2447

this method is simpler than #2447 and easier to apply to stable.
This commit is contained in:
Dylan K. Taylor 2020-01-09 21:01:12 +00:00
parent c4580dd56d
commit 0a39e580e9

View File

@ -205,14 +205,17 @@ class MainLogger extends \AttachableThreadedLogger{
$trace = $e->getTrace();
}
$message = self::printExceptionMessage($e);
$stack = Utils::printableTrace($trace);
$this->synchronized(function() use ($message, $stack) : void{
$this->critical($message);
foreach($stack as $line){
$this->synchronized(function() use ($e, $trace) : void{
$this->critical(self::printExceptionMessage($e));
foreach(Utils::printableTrace($trace) as $line){
$this->debug($line, true);
}
for($prev = $e->getPrevious(); $prev !== null; $prev = $prev->getPrevious()){
$this->debug("Previous: " . self::printExceptionMessage($prev), true);
foreach(Utils::printableTrace($prev->getTrace()) as $line){
$this->debug(" " . $line, true);
}
}
});
$this->syncFlushBuffer();