catch exceptions that occur during logging
Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
parent
ce10683944
commit
2943c18548
|
@ -214,6 +214,7 @@ class Log implements ILogger {
|
|||
}
|
||||
$message = strtr($message, $replace);
|
||||
|
||||
try {
|
||||
if ($level >= $minLevel) {
|
||||
$this->writeLog($app, $message, $level);
|
||||
|
||||
|
@ -231,7 +232,9 @@ class Log implements ILogger {
|
|||
$this->crashReporters->delegateBreadcrumb($message, 'log', $context);
|
||||
}
|
||||
}
|
||||
|
||||
} catch (\Throwable $e) {
|
||||
// make sure we dont hard crash if logging fails
|
||||
}
|
||||
}
|
||||
|
||||
private function getLogLevel($context) {
|
||||
|
@ -318,6 +321,7 @@ class Log implements ILogger {
|
|||
|
||||
array_walk($context, [$this->normalizer, 'format']);
|
||||
|
||||
try {
|
||||
if ($level >= $minLevel) {
|
||||
if (!$this->logger instanceof IFileBased) {
|
||||
$data = json_encode($data, JSON_PARTIAL_OUTPUT_ON_ERROR);
|
||||
|
@ -329,6 +333,9 @@ class Log implements ILogger {
|
|||
if (!is_null($this->crashReporters)) {
|
||||
$this->crashReporters->delegateReport($exception, $context);
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
// make sure we dont hard crash if logging fails
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue