Browse Source

Improved check for output throwable time in PlainTextHandler

main
Dustin Wilson 4 months ago
parent
commit
88343a348a
  1. 6
      lib/Catcher/PlainTextHandler.php

6
lib/Catcher/PlainTextHandler.php

@ -67,10 +67,14 @@ class PlainTextHandler extends Handler {
if (isset($frame['errorType'])) {
$method = "{$frame['errorType']} ({$frame['class']})";
} elseif (isset($frame['function'])) {
if (str_contains($frame['function'], '{closure}')) {
$method = "{$frame['function']}()";
} else {
$ref = new \ReflectionMethod($frame['class'], $frame['function']);
$method .= (($ref->isStatic()) ? '::' : '->') . $frame['function'] . '()';
}
}
}
$output .= sprintf("%{$maxDigits}d. %s %s:%d" . \PHP_EOL,
$key + 1,
@ -92,7 +96,7 @@ class PlainTextHandler extends Handler {
$this->log($outputThrowable['controller']->getThrowable(), $output);
}
if (!empty($outputThrowable['time'])) {
if (isset($outputThrowable['time']) && $outputThrowable['time'] instanceof \DateTimeInterface) {
$timestamp = $outputThrowable['time']->format($this->_timeFormat) . ' ';
$output = ltrim(preg_replace('/^(?=\h*\S)/m', str_repeat(' ', strlen($timestamp)), "$timestamp$output"));
}

Loading…
Cancel
Save