mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-21 08:17:34 +00:00
MainLogger: Log exceptions as a single block message
This commit is contained in:
parent
a555f21b18
commit
dd0aaf59b5
@ -140,18 +140,20 @@ class MainLogger extends \AttachableThreadedLogger implements \BufferedLogger{
|
||||
$trace = $e->getTrace();
|
||||
}
|
||||
|
||||
$this->buffer(function() use ($e, $trace) : void{
|
||||
$this->critical(self::printExceptionMessage($e));
|
||||
foreach(Utils::printableTrace($trace) as $line){
|
||||
$this->critical($line);
|
||||
$lines = [self::printExceptionMessage($e)];
|
||||
$lines[] = "--- Stack trace ---";
|
||||
foreach(Utils::printableTrace($trace) as $line){
|
||||
$lines[] = " " . $line;
|
||||
}
|
||||
for($prev = $e->getPrevious(); $prev !== null; $prev = $prev->getPrevious()){
|
||||
$lines[] = "--- Previous ---";
|
||||
$lines[] = self::printExceptionMessage($prev);
|
||||
foreach(Utils::printableTrace($prev->getTrace()) as $line){
|
||||
$lines[] = " " . $line;
|
||||
}
|
||||
for($prev = $e->getPrevious(); $prev !== null; $prev = $prev->getPrevious()){
|
||||
$this->critical("Previous: " . self::printExceptionMessage($prev));
|
||||
foreach(Utils::printableTrace($prev->getTrace()) as $line){
|
||||
$this->critical(" " . $line);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
$lines[] = "--- End of exception information ---";
|
||||
$this->critical(implode("\n", $lines));
|
||||
|
||||
$this->syncFlushBuffer();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user