mirror of
https://github.com/Seldaek/monolog.git
synced 2025-10-23 01:26:11 +02:00
Add support for previous exceptions in LineFormatter
This commit is contained in:
@@ -73,7 +73,14 @@ class LineFormatter extends NormalizerFormatter
|
||||
}
|
||||
|
||||
if ($data instanceof \Exception) {
|
||||
return '[object] ('.get_class($data).': '.$data->getMessage().' at '.$data->getFile().':'.$data->getLine().')';
|
||||
$previousText = '';
|
||||
if ($previous = $data->getPrevious()) {
|
||||
do {
|
||||
$previousText .= ', '.get_class($previous).': '.$previous->getMessage().' at '.$previous->getFile().':'.$previous->getLine();
|
||||
} while ($previous = $previous->getPrevious());
|
||||
}
|
||||
|
||||
return '[object] ('.get_class($data).': '.$data->getMessage().' at '.$data->getFile().':'.$data->getLine().$previousText.')';
|
||||
}
|
||||
|
||||
return parent::normalize($data);
|
||||
|
Reference in New Issue
Block a user