Skip to content
Snippets Groups Projects
Commit 96f14a2e authored by Robin Appelman's avatar Robin Appelman
Browse files

log previous exception


Signed-off-by: default avatarRobin Appelman <robin@icewind.nl>
parent 7a3ce073
No related branches found
No related tags found
No related merge requests found
...@@ -353,6 +353,27 @@ class Log implements ILogger { ...@@ -353,6 +353,27 @@ class Log implements ILogger {
return $args; return $args;
} }
private function serializeException(\Throwable $exception) {
$data = [
'Exception' => get_class($exception),
'Message' => $exception->getMessage(),
'Code' => $exception->getCode(),
'Trace' => $this->filterTrace($exception->getTrace()),
'File' => $exception->getFile(),
'Line' => $exception->getLine(),
];
if ($exception instanceof HintException) {
$data['Hint'] = $exception->getHint();
}
if ($exception->getPrevious()) {
$data['Previous'] = $this->serializeException($exception->getPrevious());
}
return $data;
}
/** /**
* Logs an exception very detailed * Logs an exception very detailed
* *
...@@ -365,18 +386,8 @@ class Log implements ILogger { ...@@ -365,18 +386,8 @@ class Log implements ILogger {
$app = $context['app'] ?? 'no app in context'; $app = $context['app'] ?? 'no app in context';
$level = $context['level'] ?? Util::ERROR; $level = $context['level'] ?? Util::ERROR;
$data = [ $data = $this->serializeException($exception);
'CustomMessage' => $context['message'] ?? '--', $data['CustomMessage'] = $context['message'] ?? '--';
'Exception' => get_class($exception),
'Message' => $exception->getMessage(),
'Code' => $exception->getCode(),
'Trace' => $this->filterTrace($exception->getTrace()),
'File' => $exception->getFile(),
'Line' => $exception->getLine(),
];
if ($exception instanceof HintException) {
$data['Hint'] = $exception->getHint();
}
$minLevel = $this->getLogLevel($context); $minLevel = $this->getLogLevel($context);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment