summaryrefslogtreecommitdiffstats
path: root/lib/private/Log.php
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2018-04-10 10:30:48 +0200
committerRobin Appelman <robin@icewind.nl>2018-04-11 14:35:08 +0200
commit96f14a2e905a9d24f2b13961375c13b0193548fe (patch)
treeee12c8bde5038addf99d8cebcbaa90bef2cc8771 /lib/private/Log.php
parent7a3ce073dac286eedfa3003c4f8567827cd5f10b (diff)
downloadnextcloud-server-96f14a2e905a9d24f2b13961375c13b0193548fe.tar.gz
nextcloud-server-96f14a2e905a9d24f2b13961375c13b0193548fe.zip
log previous exception
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib/private/Log.php')
-rw-r--r--lib/private/Log.php35
1 files changed, 23 insertions, 12 deletions
diff --git a/lib/private/Log.php b/lib/private/Log.php
index 2c2b7ccb08d..85e439359fa 100644
--- a/lib/private/Log.php
+++ b/lib/private/Log.php
@@ -353,6 +353,27 @@ class Log implements ILogger {
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
*
@@ -365,18 +386,8 @@ class Log implements ILogger {
$app = $context['app'] ?? 'no app in context';
$level = $context['level'] ?? Util::ERROR;
- $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();
- }
+ $data = $this->serializeException($exception);
+ $data['CustomMessage'] = $context['message'] ?? '--';
$minLevel = $this->getLogLevel($context);